Successfully!

Error!

Conditional blank line supplement

  • Last update:  2021-12-31
  • I. Overview

    1. Problem description

    The existing Blank Line Fill Function can fill the data to a multiple of the specified number of lines. If you want to make up only when certain conditions are met, how to achieve it?

    The following example: When the number of data rows is less than 7, make up to 7 rows. When the data is greater than or equal to 7 rows, keep the original number of rows unchanged.

    1.gif


    2. Implementation ideas

    • Method 1: Use the function of complementing blank rows. When the data volume is greater than 7 rows, set the condition attribute to hide the row height.

    • Method 2: When it is less than 7 lines, use the formula to expand to 7 lines, and do not expand when it is greater than 7 lines.

    II. Examples

    1. Prepare for data

    Create a new ordinary report, create a new data query ds1, the SQL statement is as follows:

    SELECT * FROM SALES_VOLUME ${if(len(QUANTITY)=0,"","limit "+QUANTITY)}

    Note: The parameter here is the quantity. Use with limit to limit the number of rows for data query.

    2.png


    2. Design the table

    Design the table, drag the corresponding field into the cell, and the Data Setting of A2 cell is located to List, as shown in the following figure:

    3.png


    3. Add controls

    Add the number of parameters to the parameter panel, set the "QUANTITY"  to Number control, the control value is 3, as shown in the figure below:

    4.png


    4. Method 1: Use to fill blank lines

    1)Select cell A2, click on Cell Element>Advanced in the property panel on the right, check Fill Blank Data, and set the Line Numbers to 7, as shown in the figure below:

    5.png

    2) Select cell A2, click Conditional Formatting on the right attribute panel, add a Row Height conditional formatting, set the row height to 0 when &A2>7&&LEN(A2)=0, as shown in the following figure:

    Note: The meaning of the formula is to hide all data above 7 rows.

    6.png


    5. Method 2: Use formulas to make up the number of rows

    1) Insert a blank column in front of the table, and then set the formula in cell A3: if(count(B2) <7, RANGE(1, 7-COUNT(B2)), 0)

    7.png

    2) Select cell A3, add a row height condition attribute, set if the current value is int 0, the row height is also 0, that is, hide and change the row, as shown in the following figure:

    8.png

    3) Hide column A and save the preview.


    6. Effect preview

    1) PC terminal

    Save the template, click Pagination Preview, the effect is shown in section I.

    2)Mobile

    Both App and HTML5 are supported.

    1.gif

    III. Template download

    1. Method One

    For the completed template, please refer to: %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\

    BasicApplication\ Conditional blank line supplement - Method 1.cpt

    Click to download the template: Conditional blank line supplement - Method 1.cpt


    2. Method Two

    The completed template can be found in:%FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\ReportApplication\

    BasicApplication\ Conditional blank line supplement - Method 2.cpt

    Click to download the template: Conditional blank line supplement - Method 2.cpt

    Attachment List


    Theme: Report Application
    • Helpful
    • Not helpful
    • Only read

    Doc Feedback