Jump to content

Retrieving cell values without using a layout...


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

Recommended Posts

  • Newbies

I am having problems retrieving values from a table unless I am displaying a layout in FileMaker containing the fields (or table - I am not sure which...)

For example, when I have a table containing the following records:

Table: Manuals

ManualID     ManualName      Language

0001         First manual    EN

0002         Second manual   EN

0003         First manual    DE

0004         Second manual   DE



and I want to get every manual with Language="EN", I use the following AppleScript to get the IDs (not the ManualID) of those records:


--Get a reference to the table I am using

tell application "FileMaker Pro" to set manualTable to (first table where name is "Manuals") as reference

set theLanguage to "EN"



-- Get every manual with the set language

tell application "FileMaker Pro"

  set theManuals to (ID of every record of manualTable where (cell "Language" = theLanguage)) as list

end tell

This script usually works fine, but if I change "theLanguage" to "DE", the variable "theManuals" is usually undefined/empty unless the layout "Manuals" (containing all fields in the table "Manuals") happens to be displayed in FileMaker.

I can fix this by adding the line "show layout "Manuals"" before retrieving the records, but I thought that by accessing the tables directly it would be unneccessary to involve flipping layouts and windows in FileMaker when accessing the databases.

Any pointers to where I am screwing things up would be appreciated.

Link to comment
Share on other sites

I'm not an AppleScript guru, but the mistakes I typically make with it have to do with context/scope. Are you missing an "end tell" after the set theLanguage step, or did you snip out some code?

Link to comment
Share on other sites

This topic is 6614 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.