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.

FMP GetField Example Script error

Featured Replies

Greets, all:

I put this post here (in Scripts) because I believe there's a scripting issue, more than a calculation issue, going on here so I hope you don't mind.

I'm trying to learn how to use the GetField command and in the example file on FileMaker's website, it givesthis one: https://fmhelp.filemaker.com/help/17/fmp/en/index.html#page/FMP_Help%2Fgetfield.html%23 . I replicated the script in the attached file and for the life of me, I can't get it to work--it's trying to sort what's in the SortKey field, not the values in the data fields, i.e., If you enter CustomerName in the SortSelection field, it's calculated to CustomerName in the SortKey field...but when the script runs, it's sorting on what's inside the SortKey field, not the values in the CustomerName field.

Maybe I need more coffee. TIA for your help!

GetField Sort Test.fmp12

Your SortKey field is defined as =

GetField ( "SortSelection" )

This is wrong. It needs to be =

GetField ( SortSelection )

Explanation:
What you have populates the field with the values held in the field named SortSelection. This global field contains the value "CustomerName". Therefore ALL your records contain the value "CustomerName" in the SortKey field - and sorting by this field accomplishes nothing.

Changing the formula as suggested will cause the field to populate with the values held in the field whose name is held in the SortSelection field. When  this global field contains the value "CustomerName", the SortKey field will contain a copy of the customer names - and sorting by this field will accomplish the same thing as sorting by the CustomerName field (albeit more slowly due to the field being unindexed).

 

  • Author

Thanks--mind if I unquote about that? : P 

 

That's what I get for following the instructions by the letter (under Example 1's bulleted instructions.) *sigh*

 

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.