November 22, 200421 yr I may be going about this all wrong, but... I'm loading an Invoices DB with an Applescript. The AS creates one entire Invoices record (as a list), and then writes it to the DB with the following statement: create new record at end with data myFMPRecordList Invoices DB contains an Invoices_ID field. I want FM to calculate it for me, so I defined Invoices_ID as an auto-enter serial value. 'myFMPRecordList' contains a null string ("") item as the value for the Invoices_ID field. After the 'create new record', my AS invokes an FM script to calculate Invoices_ID. The script is basically just SetField[invoices_ID, GetNextSerialValue(Status(CurrentFileName), Invoices_ID) However, all that ever gets returned by GetNextSerialValue (and stored in Invoices_ID) is null. When I check the field definition, I see that the serial number has been properly incremented. Any idea why this is happening? And, is there a more direct way to do this? Thanks, Chap
November 23, 200421 yr Does this only happen when you call the FM script from your Applescript, or does it happen when you run the FM script manually?
November 23, 200421 yr Author I've posted a simple example, NextSerial.fp5. It contains a text field called ID that is defined to auto-enter a serial number. After opening NextSerial.fp5, click "Create New Record". Then click "Get Next Serial No.". It will temporarily store "Ready?" into gNextSerialNumber to demonstrate that gNextSerialNumber is being set and displayed. Click Continue and the script will set gNextSerialNumber to GetNextSerialNumber(Status(CurrentFileName), ID), and you'll see it's null. NextSerial.fp5.zip
Create an account or sign in to comment