Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
This only serves as a temporary solution until a better solution is available.
The following solution has a limitation that is that the keyword ASC and DESC of all query variables within ORDER BY must be the same. (For example, 3 variables must be ASC , ASC , ASC not ASC, ASC, DESC.
This article showcase the implementation of sort the order of multiple column in a list. This approach is useful when you want to create a ranking or ordering of your data with multiple levels of priority. Each column in the ORDER BY clause contributes to the sorting order, and the result is a well-defined sequence of rows in the result set.
Figure 1: Example list used for this article.
Go to list then go to Data and select Database SQL Query as source of data as shown in figure 2.
Figure 2: Select Database SQL Query
Once inside the configuration, make changes to the following script and insert into the SQL SELECT Query field. Make sure to insert the correct primary key as shown in figure 3.
Figure 3: Inserted script
Primary Sorting (<column_name1> ASC):
Secondary Sorting (<column_name2>
ASC):
Tertiary Sorting (<column_name3>
ASC):
--Script-- -- this method sorts the table with correct order_by and creates an index column for it. -- this method requires user to select the order by <index name> in the list properties page as seen Figure 4 -- <column_name> & <table_name> are placeholder. Replace placeholders with desired value. SELECT ROW_NUMBER() OVER (ORDER BY <column_name1> ASC, <column_name2> ASC, <column_name3> ASC) AS sorted_index, <column_name>, <column_name> , <column_name> , <column_name>, <column_name> FROM <table_name>
Set the Order and Order by properties in list settings
Figure 4: List properties configuration
Result
Figure 5: Result