Query data by day, week and month transfer

  • Last update:  2021-10-25
  • I. Overview

    1) Expected effect

    In our daily life, we often query and filter the data of a day, a week and a month, as shown in the figure below:

    gif.gif

    2) Implementation roadmap

    Use radio button Group widget parameters and time parameters to control the time range data to be queried.

    II. Steps

    1. Data preparation

    In the FineReport Designer, click File >New General Report and create template dataset ds1. SQL statement:

    select * from ORDERS
    where 1=1 ${IF(Query_type="DAY","AND ORDERDATE >= '"+ YYYYMMDD_S+"' AND ORDERDATE< '"+YYYYMMDD_E+"'" ,
    IF(Query_type="WEEK","AND ORDERDATE>='"+YYYYWW_S+"' AND ORDERDATE<'"+YYYYWW_E+"'","AND ORDERDATE>='"+YYYYMM_S+"' AND ORDERDATE<'"+YYYYMM_E+"'"))}

    Query_type is the radio button widget parameter.

    YYYYMMDD_Sis the starting parameter of day and YYYYMMDD_E is the ending parameter of day.

    YYYYWW_S is the starting parameter of week and YYYYWW_E is the ending parameter of week.

    YYYYMM_S is the starting parameter of month and YYYYMM_E is the ending parameter of month.

    Order date is a time field. You can replace the corresponding order date field with a week and month field.

    The template design is shown below:

    1.jpg


    2. Adding widgets

    1) Enter"Parameter Panel" and add all parameters on the Component Settings interface of the right property panel;

    Set Query_type to "Radio button Group widgets" and set all remaining parameters to "Date widgetls";

    As shown below:

    2.jpg

    2) Adjust the size and position of the widgets on the parameter panel;

    YYYYMMDD_S, YYYYMMDD_E, YYYYWW_S, YYYYWW_E, YYYYMM_S, YYYYMM_E are all set to date and set widget value and Label name respectively.

    widget values are as follows: 2010-01-23, 2011-07-23, 2010-07-23, 2011-01-23, 2011-01-01, 2011-02-23;

    The label names are as follows: Day time start parameter:, Day time end parameter:, Week start parameter:, Week end parameter:, Month start parameter:, Month end parameter:

    Set the label name for the Query_type parameter widget, for the radio button group widget parameter:.

    The following is the steps for setting widget value and tag name for the YYYYMMDD_S parameter, as shown below:

    3.jpg

    3) Set the following values for the YYYYMMDD_S, YYYYMMDD_E, Query_type, YYYYWW_S, YYYYWW_E, YYYYMM_S, YYYYMM_E tags. widget values are as follows: Day time start parameter: Day time end parameter: Radio button group widget parameter:, Week start parameter:, Week end parameter:, Month start parameter:, Month end parameter: The YYYYMMDD_S label widget sets the widget value as shown below:

    4.jpg

    4) Select the "Radio button Group widget" parameter widget and choose Widget Settings >Attribute on the right side of the property panel; Property, set the data dictionary for it, set the type to "Custom", and set 3 actual values (DAY, WEEK, MONTH). Each displayed value is the same as its corresponding actual value.

    As shown below:

    5.jpg


    3. Effect preview

    1) PC

    Save the template and click the Pagination Preview to see the same effect as in Section I.

    2) Mobile 

    APP and HTML5  are as shown below:

    gif2.gif

    III. Download the template

    For the completed template, see: %FR_HOME%\webapps\webroot\WEB-INF\reportlets\doc-EN\Parameter\Query_data_by_day_week_and_month_transfer.cpt

    Click to download the template: 

    Query_data_by_day_week_and_month_transfer.cpt



    Attachment List


    Theme: Parameter
    Already the First
    • 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