Conditional formatting implement dynamic columns

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

    1. Problem description

    A dynamic column means that the column name is used as a parameter, and the column name is typed in the query button and clicked on the search, the column will be displayed in the report, as shown in the following figure:



    2. Implementation ideas

    Use conditional fromatting to hide columns to achieve dynamic column effects.


    II. Example

    1. Prepare data

    Create a new general report, create a data query ds1, the SQL statement is: SELECT * FROM Sales_Volume where Product='Milk''



    2. Design table

    Design the report form and drag the corresponding field to the cell, as shown in the following figure:



    3. Add widgets

    1) Add widgets

    Add a label widget, a drop-down checkbox widget, and a query button to the parameter panel. As shown below:

    • The widget value of the label widget is a string type: Column name:

    • The widget name of the drop-down checkbox widget is: Column name



    2) The data dictionary settings 

    The data dictionary settings of the drop-down checkbox are shown in the figure below:



    4. Add conditional attributes

    Select cells A1 to E1, add the column width condition formatting, and set the column width to 0 when the current value is not included in the column name parameter, as shown in the following figure:



    5. Effect preview

    1) PC terminal

    Save the report, click the Pagination Preview, the effect is as shown in the figure below:



    2) Mobile



    III.Template download

    The completed template can be found at: %FR_HOME%\webroot\WEB-INF\reportlets\doc-EN\Parameter\DynamicCol\Conditional_formatting_implement_dynamic_columns.cpt

    Click to download the template: Conditional_formatting_implement_dynamic_columns.cpt

    Attachment List


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