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.

Getting the index of the current record

Featured Replies

OK, I'm stumped and obviously missing something. How can I get the index of the current record so I can use it like this (where 'N' would be the index):

set x to get cell "A" of record N of layout "A" of window 1 of database "Test"

I know I could write:

set x to get cell "A" of current record of layout "A" of window 1 of database "Test"

but for some odd reasons that's not working in all of the cases in FM 7 (I get object not found). So back to the original question - how do I get it?

Well, I understand that you are writing in pseudo-code...but you should get the terminology straight...a database contains fields which are stored in tables. A layout and a window are simply GUI items that will have little impact on your actual "code".

This is a set field through a relationship or join (terms are synonmous). So you would SetField "FieldOne" to "RelationshipName::FieldTwo". Assuming a couple of things the syntax would be like:

SetField [gClientID; ClientsByName::ClientID]. This would set the "gClientID" field with the contents of the "ClientID" field through the relationship defined as "ClientsByName".

  • Author

Hi Kurt,

Honestly I don't know if you're replying to my post since it seems to have no bearing on what I was asking. Regarldess, the 'pseudo-code' you refer to is actually 'real' AppleScript code that compiles and executes just fine...

Perhaps you were actually responding to someone else's post?

Oddly enough, the pseudo-code is not only AppleScript code, it works fine on my machine. So what's up with that :-?

Hi Kurt,

Honestly I don't know if you're replying to my post since it seems to have no bearing on what I was asking. Regarldess, the 'pseudo-code' you refer to is actually 'real' AppleScript code that compiles and executes just fine...

Sorry, I was not paying attention to the Forum and just addressing the question as a general one.

Especially when dealing with FM7 and applescript you need to mention whether you're writing the script externally in applescript's script editor or inside Filemaker. With external editors applescript gets confused about which version of Filemaker you are talking to. What has worked best for me to clear this up is to get the full app path. I do a choose file so I can get the path then write the scripts this way:

tell application "Cube 1:Applications:FileMaker Apps:FileMaker Developer 7:FileMaker Developer.app:"

-- your syntax worked for me:

set x to get cell "DBNames" of record 1 of layout "DBNames" of window 1 of database "DBNames"

end tell

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.