February 17, 201114 yr 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
February 18, 201114 yr 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.
February 18, 201114 yr Author 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.
April 1, 201114 yr 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.
April 2, 201114 yr Sorry.... I just found the answer myself..... the pk ID field needs to be a number field....
April 4, 201114 yr 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...
Create an account or sign in to comment