Custom Sort Order

  • Last update:February 23, 2024
  • Overview

    Expected Effect

    For 11.0.3 and later versions, you can use the advanced sorting function to achieve multi-column sorting. However, for versions earlier than 11.0.3, you may not know how to achieve custom sorting order for data columns with fewer records and no sorting rules. Take sorting by size as an example, as shown in the following figure.

     1.png

    Solution

    You can use formulas to achieve multi-column sorting.

    Example

    This document introduces how to use the advanced sorting function with a built-in dataset to set a custom sort order.

    Data Preparation

    Create a general report, create a built-in dataset, and add two fields size and number. The size field ranges from XS to XXL, and needs to be shuffled; the number field can be set randomly, as shown in the following figure.

     2.png

    Report Design

    Drag the data columns into cells A2 and B2, enter the corresponding titles in cells A1 and B1, and customize the table style, as shown in the following figure.

     3.png

     

    Advanced Sorting Setting

    The left parent cell of the report is cell A2. Select cell A2, click the Cell Element icon, click Advanced, set Sort Rule to Ascend and Sort Basis to Formula, and enter the formula switch($$$,"XS",1,"S",2,"M",3,"L",4,"XL",5,"XXL",6) or INDEX($$$,"XS","S","M","L","XL","XXL").

    The formula description is as follows:

    $$$: the current data column

    switch: If the current value is XS, then return 1; if the current value is S, then return 2, and so on.

    INDEX: return the position of the current value in the sequence "XS", "S", "M", "L", "XL", and "XXL".

    Finally, sort according to the size of the returned number.

     4.png

    Effect Display

    On PC

    Save the template, click Pagination Preview, and the data will be arranged in the order of XS, S, M, L, XL, XXL, as shown in the following figure.

     1.png

    On Mobile Terminals

    The template can be previewed on both the DataAnalyst and HTML5 apps. The effect is shown in the following figure.

     5.png

    Template Download

    You can download the template.Custom sort order.cpt

     

    Attachment List


    Theme: Report Application
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

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

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

    不再提示

    9s后關閉

    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