Skip to main content

Tips & Tricks: How to sort tables and hierachies

There are two points where data can be sorted. On the one hand, this function may be carried out directly in the data source; on the other hand, the client tool can sort the data.

If the data is sorted once and always retrieved in accordance with the same sorting, then it is generally more performant and easier to implement if the data is sorted directly in the database. The client function is frequently used if the user is to be offered an interactive sorting. Thus, the data does not have to be retrieved again in case of a different sorting, but may be sorted locally. This reduces the load on the database server and ensures a better performance in the application.

To this end, arcplan offers the function SORT(Param1;Param2;Param3-n), which allows for the sorting of any number of objects in accordance with a sorting criterion. Param1 contains the sorting criterion, Param2 contains the sorting order and Param3-n are the objects to be sorted. A simple sorting function may e.g. look as follows: SORT([OBJ1;COLUMN1] ; ASCENDING ; [OBJ1] ; [OBJ2])

If a hierarchy is to be sorted, a sorting criterion and a sorting order must be determined for each hierarchy level. This is implemented in the screenshot and the attached template files as an example.

 

Thus, the developer has quite a lot of flexibility in developing the reports.

This function is particularly interesting if the user is offered a dynamic sorting e.g. in all column headers.