Overview
Expected Effect
Some users want to sort each column individually based on dynamic columns, as shown in the following figure.
Implementation Method
Sort each column after setting expansions based on dynamic columns achieved by functions.
Procedure
Template Preparation
1. Take the template in the document Achieving Dynamic Columns Through Functions as a basis and modify the template.
2. Enter Number in cell A1, as shown in the following figure.
3. Choose Template > Repeat/Freeze, click Pagination Preview, select Repeat Title Row From No. 1 Row to No. 1 Row, and click OK, as shown in the following figure.
4. Modify the SQL statement of ds1 to SELECT * FROM ORDERSDETAIL.
Dynamic Parameter Adding in Cell B1
Select cell B1 and add a hyperlink (dynamic parameter type) to cell B1.
Add two parameters order (value formula: if($order = 1, -1, 1)) and index (value formula: &B1), as shown in the following figure.

Sort After Expansion
Set Sort Basis to Formula and if(isnull($index), A2, if($order = 1, EVAL("B2[;B1:" + $index + "]"), EVAL("-1*B2[;B1:" + $index + "]"))) and Sort Rule to Ascend.
When order is 1, the values of the clicked column obtained by EVAL("B2[;B1:" + $index + "]") are sorted in ascending order. When order is -1, the values of the clicked column are first converted to negative numbers and then sorted in ascending order based on the negative numbers.
The following table describes the formula.
Effect Display
On PC
For details, see section "Expected Effect."
On Mobile Terminals
The following figure shows the preview effect on the DataAnalyst and on HTML5 apps.
Template Download
You can download the example templat Achieving Multi-Column Sorting Through Dynamic Columns.cpt.