Report development tips based on the number of clicks odd-odd sort

Source: Internet
Author: User

When sorting, many times we may want to implement the order of ascending order according to the number of clicks, that is to say, click on the first click of the title, click on the descending order, and so on, instead of ascending by selecting ascending order, choose descending order Descending.

Sample tool: report development tool Finereport

Solution Ideas

By the extension after the sort, you can determine the value of the parameter in ascending or descending order, here can also be implemented, define a parameter, if the parameter value is 1, in ascending order, the parameter value is 0, according to the data column of the negative number in ascending order, that is, the data column descending.

Note: This method only applies To fields where the data type of the Sort data column is numeric, and if the data type is a character type, see the character type based on the parity of clicks

The following is a simple example, the template based on order ID ascending descending order, the first click on the ID of the time ascending, click again in descending order, and so on.

Example

1 Opening a template

Open the Template:%fr_home%\webreport\web-inf\reportlets\doc\primary\detailreport\details.cpt.

2 Hyperlink settings

Select the A1 cell, right-select the hyperlink, add a dynamic parameter, increment a dynamic parameter a, and the parameter value is the formula if ($a ==1,0,1), such as:

650) this.width=650; "style=" padding-bottom:5px;padding-top:10px;padding-left:0px;padding-right:0px; "src=" http:/ /www.finereporthelp.com/help/13/15/8-1.png "/>

Note: The meaning of the formula is that if you click the hyperlink when the value of parameter A is 1, the value of a is changed to 0, and if the value of a is not 1, click the hyperlink to change the value of a to 1.

3 Sorting settings

There are two ways to set the sort settings, advanced sorting and post-extension sorting, and here are two ways to set them up.

    • Advanced sorting

Double-click the A2 cell, select advanced , select Ascending at the sort order, and the formula value is if ($a ==1,$$$,-$$$), such as:

650) this.width=650; "style=" padding-bottom:5px;padding-top:10px;padding-left:0px;padding-right:0px; "src=" http:/ /www.finereporthelp.com/help/13/15/8-2.png "/>

Note: The meaning of the formula is that if the dynamic parameter value is 1, then the order ID is sorted in ascending order ID, if not 1, according to the order ID of the negative number in ascending order, that is, according to the order ID of the descending sort, because only the numeric data can be negative, character data no negative number, Therefore, this method is only applicable to numerical field sorting.

another: If the order ID is sorted in ascending descending sequence according to the freight charge, then the formula should be: if ($a ==1, freight,-freight charges) , because the sort here is to set the sort of data column, the name of the data column is entered in the formula.

    • Post-Extension sorting

Select A2 cells, and in the cell property sheet > Extended Properties , choose Ascending, and the value is Formula =if ($a ==1,a2,-a2), such as:

650) this.width=650; "style=" padding-bottom:5px;padding-top:10px;padding-left:0px;padding-right:0px; "src=" http:/ /www.finereporthelp.com/help/13/15/8-3.png "/>

Note: The formula is the same as above, here is sorted according to the cell, so the formula is entered in the cell, not the data column name.

another: If the order ID needs to be sorted in ascending descending sequence according to the freight charge, the formula should be: if ($a ==1,f2,-f2)

4 Effect View

Whether based on advanced sort settings or extended post-order settings, the effect is as follows:

650) this.width=650; "Title=" Click to view the original size picture "class=" Magplus "style=" padding-bottom:5px;padding-top:10px;padding-left:0 px;padding-right:0px, "src=" Http://www.finereporthelp.com/help/13/15/8-4.gif "width=" height= "313"/>

For completed templates, please refer to %fr_home%\webreport\web-inf\reportlets\doc\specialsubject\orderreport\order_4.cpt


This article is from the "West Lake Bully" blog, please be sure to keep this source http://10143917.blog.51cto.com/10133917/1639396

Report development tips based on the number of clicks odd-odd sort

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.