January 26, 201510 yr Hello Is it possible to have a single script step that can be used to Sort on a number of different layouts each using records from different tables but where the sort field always has the same name - Type I thought of setting the Sort field something like a global field in a Globals table that evaluates Get(LayoutTableName)&"::Type", or a variable but cannot figure out how to use this in Filemaker's Sort function. Thanks Paul
January 26, 201510 yr No. The Sort Records by Field script step is the closest you can get. If you leave the sort field unspecified in the script step, it will sort by whatever the active field is at the time the script step executes. You still need a way to make the field you want the active field. The Go to Field script step doesn't let you specify a field name by calculation. However, you can name the field object on your layout, for example "Type", and Go to Object: Go to Object ["Type"] Sort Records by Field [Ascending] // no field specified Another option that you could use to sort on a field (or several fields!) specified by name is the Virtual Sort module; but you should see if the Sort Records by Field step does what you want first.
January 26, 201510 yr Are you aware that you can click into a file you want to sort and right click and choose a sort? Or go into table view and sort on the header?
January 26, 201510 yr Author Lee - Yes thanks, but this is for a multi-user application where as much as possible is scripted. jbante - Using your Go To Object Suggestion works great. Thanks
January 27, 201510 yr jbante - Using your Go To Object Suggestion works great. Yes, that will work in your described situation. However, you should consider if the described situation is a good one to find yourself in. I suspect there is a deeper structural issue lurking behind this - and you would be better off solving this instead of one of its symptoms.
January 29, 201510 yr If this is a Mac-only implementation, you could also use Perform AppleScript: http://fmforums.com/forum/topic/51162-sort-records-in-filemaker-with-applescript/ I do this often, and it works beautifully!
Create an account or sign in to comment