Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4994 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I am starting to use simple SQL commands to create new records and cannot find a way to return the primary key from the record that was created.

Is there a combination of INSERT/SELECT that will do this for me?

Thanks

Tim

Posted

You will need to send two command lines:

One to insert the record

"INSERT INTO TABLENAME"

and

Another one to retrieve the zkp

"SELECT MAX (ID) FROM TABLENAME"

the latest will give you the MAX of the ID.

Posted

Great thanks Andries, will try it.

You will need to send two command lines:

One to insert the record

"INSERT INTO TABLENAME"

and

Another one to retrieve the zkp

"SELECT MAX (ID) FROM TABLENAME"

the latest will give you the MAX of the ID.

  • 1 month later...
Posted

Hi

This seems very great and I was playing with this for multiply create. However, everytime there is added a digit to the serial number, the select statement does not function...

e.g.

Create record, which gets pkID 9

When you create record that gets pkID 10 the select will stay on 9.

Only if you delete all records, it can go on with 12.....99 but then it has the same issue....

Does anyone know if this is normal, if it is a limitation in the Filemaker SQL functions or if it is a ScriptMaster issue ?

You will need to send two command lines:

One to insert the record

"INSERT INTO TABLENAME"

and

Another one to retrieve the zkp

"SELECT MAX (ID) FROM TABLENAME"

the latest will give you the MAX of the ID.

Posted

Hi

This seems very great and I was playing with this for multiply create. However, everytime there is added a digit to the serial number, the select statement does not function...

e.g.

Create record, which gets pkID 9

When you create record that gets pkID 10 the select will stay on 9.

Only if you delete all records, it can go on with 12.....99 but then it has the same issue....

Does anyone know if this is normal, if it is a limitation in the Filemaker SQL functions or if it is a ScriptMaster issue ?

Is your pkID a Number field? It sounds like it is a simple text field, in that case 9 is bigger than 10... the same holds for 12..99, where 99 is bigger than 100 in a alphabetical sort.

edit: didn't read the previous post...

This topic is 4994 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.