The FineReport method sorts the clicks based on the number of clicks, and the number of clicks of finereport.
When you use FineReport to sort a report, you may want to sort it in ascending or descending order based on the number of clicks. That is to say, you can click the title for the first time to sort it in ascending order, and click again to sort it in descending order, rather than selecting ascending to sort in ascending order, you can select descending to sort in descending order.
According to the sorting after expansion, we can determine whether the values are in ascending or descending order based on different parameter values. Here we can also implement this idea and define a parameter. If the value of this parameter is 1, in ascending order, when the parameter value is 0, the data column is sorted in ascending order according to the negative number of the data column, that is, the data column is in descending order.
The method provided in this article is only applicable to the fields whose data type is Numeric. The data type is dense. We will introduce it later.
The following is a simple example. The template is sorted in ascending order according to the order ID. The template is sorted in ascending order when the order ID is clicked for the first time, and then in descending order when the order ID is clicked again.
1. Set hyperlinks
Select cell A1, right-click the hyperlink, add a dynamic parameter, and add a dynamic parameter a. The parameter value is formula if ($ a =, 1), for example:
2. Sorting settings
There are two ways to set sorting: advanced sorting and extended sorting. The following describes the two methods respectively.
(1) advanced sorting
Double-click cell A2, select advanced, and select ascending in the sorting order. The formula value is if ($ a = 1, $ ,? $), Such:
Note: If the dynamic parameter value is 1, the Order ID is sorted in ascending order by order ID. If the value is not 1, sort by order ID in ascending order, that is, sort by order ID in descending order. Because only numeric data has negative numbers, numeric data does not have negative numbers, therefore, this method is only applicable to sorting numeric fields.
In addition, if the order ID is sorted in ascending order by shipping fee, the formula should be: if ($ a = 1, shipping fee,-shipping fee ), because sorting sets the sorting of Data columns, the name of the data column is entered in the formula.
(2) sorting after Extension
Select cell A2, and select ascending after extension in cell Attribute Table> extension attribute. The value is formula = if ($ a = 1, A2,-A2), for example:
Note: The formula indicates the same as the preceding one. In this example, cells are sorted. Therefore, cells are entered in the formula, not the data column name.
In addition, if you want to sort order IDs in ascending order by shipping fee, the formula should be: if ($ a = 1, F2,-F2)
3. view results
Whether it is based on advanced sorting settings or extended sorting settings, the setting effect is as follows: