Script Of Dashboard

<< Click to Display Table of Contents >>

Current:  Script 

Script Of Dashboard

Previous pageReturn to chapter overviewNext page

The user can achieve the control of the whole dashboard through the script. For example, the timed refresh of dashboard can be achieved through the script. The overall control of all components can be achieved through the script of dashboard.

The dashboard script is divided into operating script during loading and operating script during change. The execution conditions of two types of script are different. The operating script during loading operates when the dashboard is opened, and the operating script during change operates when the component changes.

 

Opening mode

Select Script in the Dashboard menu bar to open the script dialog.

script7

script8

[On Load]: The script content is run when the dashboard is newly opened or when the dashboard is previewed.

[On Change] means that the contents of the script are run when the component changes.

A detailed description of script functions can be found in Top Level Scope Functions and Dashboard Level Functions.

 

Dashboard script function description

Click on the dashboard script function and the corresponding description appears in the right box.

script9

Dashboard component scripts, top-level scope scripts, and dynamic calculator scripts all have corresponding script function descriptions.

 

Application Example 1

As shown in the figure below, the user needs to implement the report or preview mode. When selecting a product type, all products of this type are checked and displayed on the chart. That is, when one parameter content changes, the other parameter content is automatically selected.

script10

The user needs to set a filter on the chart. The filter condition is one of the products, {{product}, where the name of the check box is the product and is passed as a parameter to the chart. At the same time, the filter needs to be set on the list parameter, and the filter condition is PRODUCT_TYPE =?{producttype}, where the name of the drop-down list is the product type and is passed as a parameter to the list parameter. The user needs to right-click on the blank space of the dashboard, select the script, and choose to run when loaded. The contents of the script are:

script11

Then, when viewing the report or when opening the dashboard in preview mode, toggle the option in the product type parameter, the contents of the product parameters are selected, as shown in the following figure.

script12

 

Application Example 2

1. Suppose there is a table, as shown in the figure below.

script13

2. In order to achieve ranking statistics for the "Sum _SALES", you need to use advanced sorting, as shown in the following figure. The prerequisite for using advanced sorting is that the table components are in an aggregated state.

Advanced sorting applies to tables in aggregated state, pivots, and charts in an aggregated state. Only dimension data segments have advanced sorting attributes, data segments of the metric type do not have this attribute, and advanced sorting enables sorting of aggregated metric fields.

script14

3. As shown in the figure below, the data in the table component is sorted in descending order according to the summation information of the SALES field, that is, in descending order of the Sum _SALES field.

script15

4. The result of the sorting is shown in the figure below.

script16

5. When the TopN option in the advanced sort dialog box is set to 4, the data in the table will be filtered and only the first four data of "Sum_SALES" will be retained. When "Group the data outside the TopN as 'Others'" is checked, except that TopN data, remaining data is displayed in other.

6. The retention result is shown in the figure below.

script17

 

7.When the user needs to change the number of reservations in real time, it can be achieved through a script.

7.1 First create a list parameter and modify it to be a single choice. Bind the data of the number type in any query, as shown in the following figure.

script18

7.2 Select Script in More in the menu bar.

7.3 In the script dialog box, when you change the Run tab, enter the script:

if(!isNaN(param['ListBox1'])) {

var col = Table1.binding.getCol(0);

col.sortRank=parseInt(param['ListBox1']);

Table1.binding.setCol(0, col);

}

The implementation passes the value of the parameter in ParamList1 to the TopN option in the advanced sort dialog.

script19

8. Select any of the options in the parameter list ID to implement dynamic filtering of the table components, that is, sort them in descending order of the "Sum_Sales" field.

script20