Check out passing Script Parameters to a generic sort script. Make the text at the top of each column (in the header) a button that calls the sort script. Pass the name of the field contained in the given column as a Script Parameter in the button setup. Then sort by Get(ScriptParameter). This is not exact syntax. The manual or help file will supply that.
I am not there yet, not sure how to pass the script parameter to the "sort" script step as normally you only
get the chance to use a field in the script sort command. I have tried to pass the the script parameter to a calculating
global field but not sure wether I am on the right track?
Any further help would be appreciated
When you set up the button behavior, select "perform Script" and select your sort script. Let's say this "button" is a simple text block that has "Date" in it and is placed in the header above your actual date field. When you select your script you'll see you can enter an optional script parameter. Enter "YourTable:: DateField". Now in your sort script sort by the script parameter using Get(ScriptParameter). This will work as it references a field. Now, let's say you have a "Name" column. USING THE SAME SCRIPT, set up this other button to perform the script and use "YourTable:: Name" as the script parameter. This way you can recycle the same script but pass a different parameter to produce the results you need. This should be enough to get you started. I don't have FM open in front of me, so check syntax before implementing, but this is the idea.
Got that now I will try it out later
Once again many thanks for the help