Jump to content

FMP GetField Example Script error

Recommended Posts

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

Link to post
Share on other sites

Your SortKey field is defined as =

GetField ( "SortSelection" )

This is wrong. It needs to be =

GetField ( SortSelection )

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).


Link to post
Share on other sites

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*


Link to post
Share on other sites

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.