Use a sort script step triggered by OnLayoutEnter.
Thank you for your reply.
Unfortunately, this would not solve my problem as I need my script to be triggered by the push of button, and not upon entering the layout. Furthermore, the OnLayoutEnter trigger is already used in most of the layouts where I want to use the script.
My question is more about the possibility to execute a 'Sort Records' script step (or a 'Perform find' script step, for that matter) targeting a field whose name would be the result of a calculation, a little bit like the 'Set Field By Name' script step target a field.
If each field on which you want to sort is present on the layout, you can:
Give each field object for a field on which you want to sort, give it an object name using the Inspector's Name box.
Then this script might be used:
Go to Object [ Get ( ScriptParameter ) ]
Sort Records by Field [ascending]
Sort Records sorts records by a single specified field. If you do not specify a field in the script, this step uses whatever field is currently the active field so go to object can be used to put the focus into a specific field. You'd pass the object name to the script as a script parameter specified in either button set up or in the script trigger setup where this script is specified as the script to run when that button is clicked or that trigger is tripped.