反馈已提交

网络繁忙

You are viewing 5.1 help doc. More details are displayed in the latest help doc.

[Direct] Use of dynamic columns in table components

  • Recent Updates: April 25, 2022
  • 1. Overview

    1.1 Expected effect

    Users can dynamically switch columns as needed for flexible queries. The metrics data under three dimensions can be switched out.

    For example, the text drop-down control switches out "User ID", "Statistics Date" and "Views Statistics" of "Access Platform".

    1.2 Implementation idea

    Dynamic column switching can be achieved using the filter component in conjunction with dynamic parameters. For the use of filter component parameters, see Filter component parameter usage.

    2. Example

    Use BI Demo data.

    2.1 Add dimension name dataset

    1)It is required to be able to drop down the text to appear the dimension name, create a new "Dimension name" SQL dataset, and get the names of all fields of the table by SQL function as follows.

    Enter the SQL statement.SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name='Internet_access_statistics_table'

    image.png

    2)Turn on real-time data for the "Dimension name" dataset, please see Real-Time Data for how to turn it on.

    2.2 Adding real-time parametric SQL datasets

    1)Add the SQL data set named "Dynamic Parameters" and enter the SQL statement.

    select access ,<parameter> ${col} </parameter> as dynamic_column from Internet_access_statistics_table

    or  SELECT COLUMN_NAME FROM information_schema.columns WHERE table_name='Internet_access_statistics_table'. As shown in the figure below.

    image (1).png

    2)Set the parameter type to text and the default value to manually enter a dimension name of type text, as shown in the following figure.

    Note: If there is a field of date type in the dimension, do not set it as the default value.

    image (2).png

    3)Turn on real-time data for the "Dynamic Parameters" dataset, see: Real-Time Data for how to turn on real-time data

    2.3 Create a dashboard

    Note: Add the chart components that require dynamic columns first, then add the filter component.

    1)Create a new dashboard and select the group table, which will look like the following.

    image (3).png

    2)Add a text drop-down filter component, as shown below.

    image (4).png

    3)Set up the text drop-down filter component with the selected value COLUMN_NAME for the field, select dynamic parameter col for the parameter, and click OK, as shown in the following figure.

    Note: To select a default value for the filter component (step 7 in the figure below). If it is a null value, the dynamic column of the form component before the filter is not null, it will display an error report, and will only return to normal status after the filter component selects a value.

    image (5).png

    4)If you only need to switch between the dimensions of "Statistics Date", "Access Platform" and "User ID", you can filter the field "COLUMN_NAME" as shown below.

    Attachment List


    Theme: Build Charts and Analyze data
    Already the First
    Already the Last
    • Helpful
    • Not helpful
    • Only read

    售前咨询电话

    400-811-8890转1

    在线技术支持

    在线QQ:800049425

    热线电话:400-811-8890转2

    总裁办24H投诉

    热线电话:173-1278-1526

    文 档反 馈

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    10s后关闭