This question is about FileMaker scripting, not about AppleScript in general. Background: A plug-in for some other software (“RagTime”) retrieves data from FileMaker via AppleEvents. With FileMaker 12, I have got a problem.
Imagine a simple FileMaker database “contacts” with two tables, “companies” and “employees”. There is a FileMaker layout displaying the address data for a company and in portal rows, the employees are listed.
First script example:
set fm_db to "contacts"
tell application "FileMaker Pro"
tell window 1 of document fm_db
set my_result to (get data of current record)
end tell
end tell
my_result
This returns all values from the record. Fields in portal rows are returned as lists with one entry for each employee.
Second Script:
set fm_db to "contacts"
tell application "FileMaker Pro"
tell window 1 of document fm_db
set my_result to (get data of every cell of current record)
end tell
end tell
my_result
This returns a list where only the first employee appears as a single entry. But there is a second difference: The first script returns the fields in the order of the geometrical arrangement in the layout (top-down, left-right). The second script seems to return the fields in the order in which they have been added to the layout.
A third script to get the field names:
set fm_db to "contacts"
tell application "FileMaker Pro"
tell window 1 of document fm_db
set my_result to (get name of every field)
end tell
end tell
my_result
Now finally the problem: I need the lists of employees as in the first script and I need the field names, the values belong to. But the thirds script uses the same order as the second.
Currently I got stuck. Does any FileMaker scripter know a way to retrieve data from a window including all portal rows and to retrieve the field names in a consistent order?
(FileMaker 5 through 11 used the same order for field names as for the values in script 1.)
Sorry, if this is quite exotic. But any tip would be welcome.
Jürgen