Dynamic Column Sorting

SailRCG
edited July 28, 2021 in Analytics #1
I regularly receive requests to provide column sorting functionality in report designs. To do this I simply create a dynamic 'order by' clause controlled by some hidden parameters and column hyperlinks. Admittedly, I use this method on relatively simple and fast queries because the solution requires re-execution for every sort selection.<br />
Here's how it's done: (after you've created a report with a table )<br />
<br />
1 - Create a Boolean parameter for each column to be sorted.<br />
<br />
2 - Add script to the beforeOpen of the Data Set.<br />
<br />
3 - Create hyperlinks for each column corresponding to the parameters you created in step 1.<br />
<br />
That's all there is to it.<br />
<br />
I've attached an example built on the Classic Models database for your enjoyment.