Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

AppleScript - grabbing value from related table

Featured Replies

Hello, new here...

 

I was hoping someone could help me with this simple application of AppleScript within FileMaker.

I'm trying to grab the value of a field and have it as a variable in AppleScript

set myVar to cell "Index #"

This works fine. Index # is a field on current layout and while in Layout Mode its name displays exactly like this.

But when I attempt to grab value of a field which in Layout Mode displays as ::Name then I get Object not found error. This field is still on the current layout but orignating from related table "Personal Data"

 

How do I reference this related table and grab its field value?

 

How do I reference this related table and grab its field value?

 

If you're doing this in FileMaker, then you reference the field like in any other FileMaker calculation; your AppleScript is simply a combination of static AppleScript and dynamic FileMaker field data, calculated according to FileMaker syntax:
"set myVar to " & Personal Data::name & """
or a bit easier on the eye:
"set myVar to cell " & Quote ( Personal Data::name )
 
If you want to (re-)define the variable from within an AppleScript, use
tell application "FileMaker Pro"
set myVar to cell "Name" of table "Personal Data"
 
The question of course is from which record you want to grab that field value …
set myVar to cell "cLocation" of record 2 of table "PTO__StockTransactions"
  • Author

Thank you, that helped

  • Author

if I may revive the subject...

I need to resort to the option where you specified what record to grab:

set myVar to cell "cLocation" of record 2 of table "PTO__StockTransactions"

I do not know the record number itself but what I do have is the value of another parallel field which belongs to the same record from that "PTO__StockTransactions" table. How do I combine that in AS?

set myVar to cell "cLocation" of record (* whose field "referenceNo" has value "12345" *) of table "PTO__StockTransactions"

*** 12345 is FileMaker automatically generated indexed number actually, not a string.

I do not know the record number itself but what I do have is the value of another parallel field

 

Try

set myVar to cell "desiredField" of (every record whose cell "referenceNo" = "someNumber") of table "myTable"
where it seems that, if referenceNo is a number value, you can pass the search value with or without quotes.
  • Author

thanks, I get "Event not handled" error though...

This syntax works for me. I guess you need to experiment a bit.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.