Displaying Different Columns Based on Parameter Values

  • Last update:June 06, 2025
  • Overview

    Version

    Report Server VersionFunctional Change

    11.0

    /

    Expected Effect

    In some cases, you need to select different parameters to display different template content. For example, you can display different summary reports according to the summary types selected by the radio button group, as shown in the following figure.

    动图1.gif

    Implementation Method

    To display different columns in a report by using the parameter widget, you can use the following two methods.

    • Method one: You can display different columns in a report by adding condition attributes.

    • Method two: You can display different columns in a report by the SQL statement.

    Method One: Adding Condition Attributes

    Data Preparation

    Create a dataset named ds1 with the SQL statement SELECT * FROM Sales_Volume.

    Component Creation

    Drag the Region and Salesperson fields into the corresponding cells, set different summary methods separately, and design the table style, as shown in the following figure.

    1.png

    Adding Parameter Widgets

    First, add the template parameter type, as shown in the following figure.

    2.png

    Add a radio button group widget and a query button widget to the parameter panel, and name the radio button group widget type. In the Data Dictionary setting box, set Type to Custom, and customize two options, as shown in the following figure.

    3.png

    Setting Condition Attributes

    Select cells A1 and A2, right-click the cells, and select Condition Attribute. Click +, set Attribute to Row Height, set Row Height to 0, and add the formula condition $type!='Region'. Similarly, select cells A3 and A4, set Attribute to Row Height, set Row Height to 0, and add the formula condition $type!='Salesperson' in the condition attribute setting box, as shown in the following figure.

    4.png

    Save the template and click Pagination Preview. In this case, you can realize the effect.

    Effect Display

    PC

    The effect is the same as that shown in section "Expected Effect."

    Mobile Terminal

    The following figure shows the display effect on the DataAnalyst app and HTML5 terminals.

    动图2.gif

    Example Two: Using the SQL Statement

    General Report Creation

    Choose File > New General Report, as shown in the following figure.

    5.png

    Adding the Parameter Widget

    Add the radio button group widget, name the widget type, and add a query button widget, as shown in the following figure.

    6.png

    Data Preparation

    Create a dataset ds1 with the SQL statement:

    SELECT${if(type="Region","Region","Salesperson")} as a,sum(Sales_Volume) num
    FROM Sales_Volume
    ${if(type="Region","group by Region","group by Salesperson")}

    The default value of the parameter type is East China, as shown in the following figure.

    7.png

    Template Creation

    Drag the a and num fields into the corresponding cells, center the fields, and set borders for the cells, as shown in the following figure.

    8.png

    Setting the Widget Parameter

    9.png

    Save the template and click Pagination Preview. In this case, you can realize the effect.

    Effect Display

    PC

    The effect is the same as that shown in section "Expected Effect."

    Mobile Terminal

    The effect is the same as that shown in section "Mobile Terminal" in section "Method One: Adding Condition Attributes."

    Template Download

    1. Method one: adding condition attributes

    For details, you can download the template Displaying Different Columns Based on Parameter Values.cpt.

    2. Example two: using the SQL statement

    For details, you can download the template Displaying Different Columns by the SQL Statement.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