Custom Sort Through Built-In Datasets

  • Last update:February 23, 2024
  • Overview

    Expected Effect

    The Custom Sort function helps directly define the order of each data item in the formula, but sometimes it can make the formula difficult to read and maintain.

    In this case, you can use built-in datasets to customize the sorting, as shown in the following figure.

     1.png

    Solution

    Retrieve the value through the dataset function, and then return the position of the cell value in the built-in dataset through the inarray() function.

    Example

    Data Preparation

    1. Create a general report and create a database query named ds1 with the SQL statement SELECT * FROM Sales.

     2.png

    2. Create a built-in dataset named Custom Order, add a column named Region Order, and enter the data in the order shown in the following figure.

    iconNote:
    The order of the Region Order column is the final sorting order.
    3.png

     

    Report Design

    Drag the data columns from dataset ds1 into the cells and design the table style, as shown in the following figure.

     4.png

    Sort After Expansion Setting

    Select cell A2, click the Cell Attribute icon, set Sort Rule to Ascend, and Sort Basis to Formula, and enter the formula inarray(A2, Custom Order.select(Region Order)).

    The following table describes the formula.

    Formula

    Description

    Custom Order.select(Region Order)

    A dataset function that returns all values of the Region Order column in the Custom Order dataset.

    inarray()

    Returns the current value of cell A2   in the Region Order.

     5.png

     

    Effect Display

    On PC

    Save the template and click Pagination Preview. The preview effect is shown in the following figure.

     开头2.png

    On Mobile Terminals

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

     开头2.png

    Template Download

    You can download the template.Custom Sort Through Built-In Datasets.cpt

     


    Attachment List


    Theme: Report Application
    Already the First
    Already the Last
    • 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