Successfully!

Error!

Sort Overview

  • Last update:  2024-02-24
  • Overview

    You may often use the sort function when displaying data or charts in FineReport reports. Generally, the sort function is widely used in data display and is not so much involved in chart display.

    This document introduces various types and applications of the sort function supported by FineReport.

    Introduction to Three Sort Methods

    FineReport supports three types of sorts: sort in datasets, advanced sort, and sort after expansion. The following table describes specific content.

    iconNote:
    Advanced sort is performed before the report is executed, while sort after expansion is performed after the report is executed.

    Sort Type
    Description

    Sort in the Dataset

    Data is directly sorted in the database query through SQL statements. For example:

    • Ascending order: SELECT * FROM Sales_Volume ORDER BY Sales_Volume

    • Descending order: SELECT * FROM Sales_Volume ORDER BY Sales_Volume DESC

    • Multi-column sort: SELECT * FROM Sales_Volume ORDER BY Product, Sales_Volume. That is, data is first sorted in ascending order by the Product column and then the Sales_Volume column is sorted in ascending order based on the corresponding product.

    Advanced Sort

    Data is sorted based on the formula and sort order set by a data column. That is, the sort is dependent on the data column and equivalent to the sort before expansion.

    Sort After Expansion

    As the most flexible sort method, sort after expansion can meet various sort requirements during report creation. However, the sort is performed after expansion, the positions of all cells are adjusted, thus causing the worst performance. You are advised to use this sort method only when advanced sort cannot be used.

    Comparison of Three Sort Methods

    Performance Comparison

    In terms of performance, sort in datasets is better than advanced sort, and advanced sort is better than sort after expansion.

    Sort Type
    AdvantageDisadvantage

    Sort in the Dataset

    This sort method boosts the best performance.

    1. All calculations must be performed in the database, causing complex SQL statements and difficult maintenance. Therefore, you are advised to use SQL statements to perform simple and single sorts (ascending/descending).

    2. Some calculations cannot be completed through SQL statements. For example, if a column is calculated based on other data columns, sort in datasets will not be applicable.

    Advanced Sort

    This sort method has the average performance, allowing you to perform relatively complex sorts through formulas based on data columns.

    Formulas must rely on data columns and the secondary calculations of formulas are caused.

    Sort After Expansion

    This sort method is the most flexible one and can meet all sort needs currently.

    It has the worst performance because sort is performed after expansion, which will adjust the positions of all cells.

    Applicable Scenario Comparison

    In terms of the applicable scenario, sort after expansion is better than advanced sort and advanced sort is better than sort in datasets. Note: All these three sort methods can be used in dashboards and general reports.

    Sort Type
    Sortable FieldAchievable Effect

    Sort in the Dataset

    Time, date, character string, value, and boolean fields

    The following effects can be achieved: 

    • Single-column sort (ascending/descending)

    • Multi-column sort (non-dynamic)

    • Single-column Dynamic Sort

    Advanced Sort

    iconNote:
    Dynamic sort is not supported. That is, you cannot sort data by clicking the column header.

    1. Multi-column sort is supported in FineReport 11.0.3 and later versions.

    2. Only the single-column sort can be achieved in FineReport earlier than 11.0.3. The following effects can be achieved:

    Sort After Expansion

    1. Dynamic and multi-column sorts are supported in FineReport 11.0.3 and later versions.

    2. The following effects can be achieved by the function itself:

    • Single-column/multi-column sort in ascending/descending order by clicking the column header (in FineReport 11.0.3 and later versions)

    • Multi-column sort based on the previously set order after the template preview (in FineReport 11.0.3 and later versions)

    • Single-column sort based on the previously set order after the template preview

    3. The following effects can be achieved by the combination with other functions:


    Attachment List


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

    Doc Feedback