Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7096 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I would like to make a single script to sort the records I am browsing in list view. I want to mimic the windows GUI where users expect to be able to click on a column header and have the data sorted ascending or descending based on the column clicked.

I can do this now with numerous sort scripts but there must be a way to script a sort where the fields to sort by are passed via a calculation or get(ScriptParameter) or something like that. I would prefer not to make a huge if/else list script.

Just trying to keep the scripts to a minimum. Any ideas oh gurus?

Posted

You might try a global to hold the last sort field and whether it was ascending or descending. Then use script parameters to tell the sort script which field to sort by. If the new sort field is the same as the last sort field, then change the ascending/descending choice.

Then use the If-Then-Else branching with multiple Sort script steps to branch to the correct Sort. It's possible to eliminate most of this by using a separate global for the sort field name and a calc defined with a GetField(gSortField) function. Then you'd only need two Sort script steps to sort by this calc ascending and descending. You may have to convert date, time, and numbers a bit to make them sort correctly with this text calc.

  • 2 weeks later...
Posted

I am trying to set-up something similar, but I would like to perform dynamic sorts with multiple keys in various order. So far I have defined a checkbox set which list the available keys. I have associated this checkbox set with a global field g.SortList. As I click on the individual check boxes the desired key order is stored in g.SortList.

So far so good. Now I would like to perform a sort using the stored list in g.SortList, but I can't find a way to perform either a sort based on the list or a number of successive sort based on each list item. However, I found that AppleScript may be able to do this:

sort v : Sort the records in a layout

sort reference : The layout to sort

[by reference] : The fields to sort by

[in order ascending/descending/custom] : The sort type

Is this really the only way?

Posted

Use calculations like

GetField(Substitute( MiddleValues( g.SortList; X; 1 );

This topic is 7096 days old. Please don't post here. Open a new topic instead.

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.