Jump to content
Server Maintenance This Week. ×

Field Order in FileMaker Layouts and AppleScript


This topic is 4086 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

(Posted the same question at MacScripter, but it is very specific about FileMaker 12.) 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.)


Jürgen

Link to comment
Share on other sites

This topic is 4086 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.