Ad-Hoc Sorting on Multiple Columns

Overview

At runtime it is possible to sort on more than one field via passing parameters through the URL. By doing this, developers can easily reuse applications to satisfy many end user sorting requests. Being able to sort on multiple columns allows a single application to display data in multiple ways, thus eliminating the need for multiple versions of the same application.

For instance, multiple column sorting can be helpful when there are users that need to see the same data sorted in different ways. Instead of having to build multiple applications and use different sequencing to achieve the desired sorting, the developer can build a link to the application passing the sorting parameter in the URL.

Let’s say I have user A who needs to see the application sorted on column 1 ascending and column 2 descending, I simple create the link for this user and place it on a menu or send the link to the user directly. Now I have user B who needs to see the same application but sorted on column 3 descending and column 5 ascending. All I have to do is create the link with the proper parameters and give the user access to the link. The developer can create as many links as needed.

Data List URL Parameters

Templates such as the Multiple Row Data List, Data List with Web Form, and Grid Update Maintainer can use the following parameters

The list of parameters involved for these templates are as follows:

  • cur_sort_col=FIELD1,FIELD2 – a list of comma separated field names. The application will sort by the specified fields, going off the order they were specified in (left to right).
  • sort_typ=0 – Can be equal to 0 or 1. A value of 0 will sort in descending order, a value of 1 will sort in ascending order.
  • reorder=Y – tells the program that reorder sort parameters are being passed.

The reorder parameter and the ability to use multiple fields for the cur_sort_col parameter are only supported in the above mentioned Data List templates.

Once implemented, the link will look like this:
DD.I00010s?cur_sort_col=FIELD1,FIELD2&sort_typ=0,1&reorder=Y

where

  • DD is the name of you data dictionary / library
  • FIELD is the name of a field in your application that you want to sort by

Report URL Parameters

The list of parameters involved for the report template are as follows:

  • cur_sort_col=FIELD – The application will sort by the specified field.
  • sort_typ=0 – Can be equal to 0 or 1. A value of 0 will sort in ascending order, a value of 1 will sort in descending order.

The reorder parameter and the ability to use multiple fields for the cur_sort_col parameter are not supported in the report template.

Once implemented, the link will look like this:
DD.R00010s?cur_sort_col=FIELD1&sort_typ=0

where

  • DD is the name of you data dictionary / library
  • FIELD is the name of a field in your application that you want to sort by

All of these parameters are case sensitive, make sure to use the same case sensitivity as in the example.

Updated on December 19, 2024

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support