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

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

Recommended Posts

Posted

Hi everyone,

I am trying to create a sort script that offers options.

I have a basic list view layout with sort buttons above certain fields (first name, last name, address, city etc.) Right now, I have each button sorting by that field. What I would like is to sort by the field then if another button is clicked it would sort by the new button first and the last button second. i.e. click last name it sorts by last name. then click city and it would sort by city and last name. I was trying to figure out a way using a global field and script parameters but have been unsuccessful so far.

Any Ideas?

thanks

Posted

that would mean a lot of sort scripts!!!

As far as i know, you would have to define a script for every combination

possible!! You could use your global field to store the name of the script

that just ran...

Something like:

Set Field gt_SortOrder to gt_SortOrder & <name of script> & "#"

Then you would just look for the "#" symbol to find out what order to sort

then run the proper script. You could use Script Parameter to pass the script name to your Set Field.

Dan

Posted

I usually sort by Whatever AND Name Last First. This is usually how people want the data.

If you are looking for a more dynamic sort, you can try using the getfield() function with several global SortChoice fields, then sort by the result of the calcs:

SortChoice1 (global, text)

SortChoice2 (global, text)

SortChoice3 (global, text)

SortChoice4 (global, text)

SortChoice5 (global, text)

SortCalc1 (calculation, text result) = getfield(SortChoice1)

SortCalc2 (calculation, text result) = getfield(SortChoice2)

SortCalc3 (calculation, text result) = getfield(SortChoice3)

SortCalc4 (calculation, text result) = getfield(SortChoice4)

SortCalc5 (calculation, text result) = getfield(SortChoice5)

Sort by:

SortCalc1,

SortCalc2,

SortCalc3,

SortCalc4,

SortCalc5

The SortChoice fields would contain the names of the fields that are used for sorting. There are a couple possible issues with this. 1. I'm not sure how to use ascending and descending choices without adding a Sort script step (with branching) for every possible permutation. 2. There could be incorrect sorting when the field types of the source fields are not text (though I believe this could be overcome.)

This topic is 7281 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.