Grouped by Formula

  • Last update:  2022-01-26
  • I. Overview

    1. Version

    Rreport server version
    10.0


    2. Expected effect

    Usually, data is grouped by a certain field, such as the date field. Each date corresponds to a group. At this time, the grouping is too detailed, and you want to display it by year and week. As shown in the figure below:

    截屏2021-01-19 上午9.31.17.png

    Note: in FineReport, the calculation logic of week formula is consistent with that in Excel, and Sunday is defined as the first day of a week. The first week of the year must begin on Sunday.

    For example, if January 1, 2010 is a Friday, then January 1, 2010 is not included in the first week of 2010, but only in the last week of 2009.


    3. Implementation method

    The date stored in the database is in the format of month, year and day. The user can group the data according to the year and week through the custom value in the custom group.

    II. Examples

    1. Report design

    1) New report

    Create a new normal report, add data set DS1, and the SQL statement is select * from orders. As shown in the figure below:

    截屏2021-01-19 上午9.31.54.png

    2) Report style

    Drag the field to the corresponding cell, and set the data in cell C2 of paid amount to summary and sum as shown in the following figure:

    截屏2021-01-19 上午9.32.08.png


    2. Custom formula grouping

    1) Order date grouped by "year"

    Select the date data column in cell A2, and modify the data setting to group and advanced. Click the custom button below to open the custom group dialog box and select formula group.

    The display mode is normal grouping. The custom value is year ($$$). The date field is grouped by "year". As shown in the figure below:

    2) Order date grouped by "week"

    Select the date data column in cell B2, and modify the data setting to group and advanced. Click the custom button below to open the custom group dialog box and select formula group.

    The display mode is normal grouping, and the user-defined value is week ($$$) + "week", so that the order date field is grouped by "week". As shown in the figure below:



    3. Summary settings

    Select cell C2, select "Cell Elements > Basic > Data Settings", and modify the data settings to "Summary" and "Sum", as shown in the following figure:

    3.png


    4. Effect preview

    1) PC terminal

    Save the template and select pagination preview. The effect is as shown below:



    2) Mobile terminal

    App and HTML5 are showing the same below:

    WechatIMG235.jpeg



    III. Template download

    For completed templates, see %fr_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\BaiscApplication\GroupInFormula.cpt

    Click download template: 

    GroupInFormula.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