Query the day and week of a month based on the date widget

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

    1) Expected effect

    Select month in the date widget to view the days and weeks of the month. As shown below:

    gif.gif

    2) Implementation roadmap

    Use the RANGE formula and DAYSOFMONTH to get the number of days in the month and concatenate the values of the widget.

    Use the SWITCH and WEEKDAY formulas to get the day of the week.

    II. Example

    1) Formula introduction

    FormulaNotes
    DAYSOFMONTH($time+"01")

    Gets the number of days in the month of the date widget


    RANGE(1, DAYSOFMONTH($time + "-01"))

    Gets the date from the first day to the last day of the date


    $time + "-" + FORMAT(A1, "#00")Concatenate the days and dates obtained earlier
    SWITCH(WEEKDAY($time + "-" + FORMAT(A1, "#00")), "1", "Monday", "2", "Tuesday", "3", "Wednesday", "4", "Thursday", "5", "Friday", "6", "Saturday", "0", "Sunday") Use WEEKDAY formula to get the day of the current week, and use SWITCH formula to display Chinese characters


    2) Insertion formula

    In the FineReport Designer, click File >New General Report;

    Right-click cell A1 and select Cell Element >Insert Formula.The formula is:RANGE(1, DAYSOFMONTH($time + "-01"))

    Right-click on cell A2 and select Cell Element >Insert Formula.The formula is: $time + "-" + FORMAT(A1, "#00")

    Right-click A3 cell and select Cell Element >Insert Formula. which is:  SWITCH (WEEKDAY ($time + "-" + FORMAT (A1, "# 00")), "1", "Monday", "2", "Tuesday", "3", "on Wednesday", "4", "Thursday", "5", "Friday", "6", "Saturday", "0", "Sunday ").

    Center the cell content, and enclose the three cells with border (border custom).

    The following figure shows the steps for cell A1, and the same steps for cell A2 and A3. As shown below:

    1.jpg

    3) Cell attributes

    The contents of A1, A2 and A3 cells are centered with a border (custom border).

    Left-click on cell A1 and select Cell Attributes >Expand in the right property panel.Select Horizontal expansion direction. As shown below:

    2.jpg

    4) Date widget

    Go to the parameter panel of the template and drag "Date widget" and "Query Button" into the parameter panel.

    The date widget name is time, the value is 2019/10/01, and the format is YYYY-MM. As shown below:

    3.jpg

    5. Effect preview

    Save the template and click Date Entry Preview the effect as described in Section I.

    Note: This method does not support mobile terminals.

    Note: No characters can be placed under the table header, otherwise there will be wrong lines in pagination.

    III. Download the template

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

    Click to download the template: 

    Query_the_day_and_week_of_ a_month_based_on_the_date_widget.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