Mandu Posted November 22, 2004 Posted November 22, 2004 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
Barbecue Posted November 23, 2004 Posted November 23, 2004 Does this only happen when you call the FM script from your Applescript, or does it happen when you run the FM script manually?
Mandu Posted November 23, 2004 Author Posted November 23, 2004 It happens when I run the FM script manually, too.
Mandu Posted November 23, 2004 Author Posted November 23, 2004 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
-Queue- Posted November 23, 2004 Posted November 23, 2004 Add quotes around your ID field in the script.
Recommended Posts
This topic is 7652 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 accountSign in
Already have an account? Sign in here.
Sign In Now