Reputation: 317
Using FileMakerPro 12/13, I want to open an external file, extract values, and use these to set the values of some script variables.
The approach is:
• Use the import function to import data from a tab delimited file into a table, where first row has field names
• Open that table and go to the first record
• Copy the field values from the first record into the variables and use the variables as required
The problems are:
• When we run the import, it seems to auto-create a new “layout” each time .. we don’t want this to happen, or, need to auto-delete these layouts after they are created. Another possible approach is to drop/delete the import table, then allow the import to re-created it … this would stop the additional layout issue perhaps? … either way, we cannot find a script function to delete a named table or layout
• We are bringing the data successfully into the table, however, we are unable to get a function or set of functions working that reads the data from that table and assigns it to a variable.
Any assistance gratefully received!
Upvotes: 0
Views: 1129
Reputation: 116982
The first problem is the result of importing into a new target table every time you import. Instead, you should create - once - a table named (for example) Variables, with the following fields:
and set your importing script (you have this scripted, right?) to import into this table. This will create a new record in the Variables table each time you import. You can delete this record when done. You cannot delete a table or a layout programmatically.
Regarding the second problem, use the Set Variable[] script step to "load" the imported values into variables, for example:
Set Variable [ $userID; Value: Variables:UserID ]
Note that immediately after import, the found set in the Variables table will contain only the imported record/s. So even if you do not delete the previously imported records, a script combining the two steps (import and set variables) will work just fine.
Upvotes: 1