Sorting String-Type Data

  • Last update:  2024-03-08
  • Overview  

    Version 

    Report Server Version
    FineReport 11.0.3 and later versions

    Application Scenario 

    If the data stored in the dataset are of string type, using the sort function of the designer will sort them following the sort rules of strings, but you want them to be sorted according to the value size, as shown in the following figure.

    Implementation Method 

    1. Modify the field type in the database.

    2. Convert strings to numbers using the TOINTEGER() function.

    Example

    Report Design 

    Create a general report and a built-in dataset, as shown in the following figure.

    The report design is shown in the following figure. Enter No. and Name in cells A1 and B1, and drag the fields into cells A2 and B2.

    Select Cell A2, choose Cell Element > Advanced, click Add Main Sort Order, set Sort Basis to Formula, enter the formula =TOINTEGER($$$), and set Sort Rule to Ascend

    iconNote:
    The setting also applies to Sort After Expansion.

    Effect Display 

    On PC

    Save the report and click Pagination Preview. The effect is shown in the "Application Scenario" section.

    On Mobile Terminals

    Save the report and click Mobile Preview. The effect is shown in the following figure.


    Template Download 

    You can download the example template. Sort string-type data.cpt

     


    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy