Top.Mail.Ru
Update Variable
CTRL+K

Update Variable

In this article
  • Update Variable
  • Usage Example
  • Click Action in YAML

Use this action to change the value of a variable in the dashboard.

Note

It is impossible to update input values and system variables using this click action.

Usage Example

As an example, consider a dashboard that displays a product price after applying a discount.

Example dashboard

  1. Two (Input Value#Dashboard Variables ../2.3.Add_setup_metric/2.Calculated_variable.md) variables are added to the dashboard: Discount and Discounted Price. The default value for Discount is 10, and for Discounted Price it is 0. Example screenshot 1
  2. Three widgets are added to the view: (Parameter ../2.1.Edit_mode/11.Variable.md), (Text ../2.1.Edit_mode/14.Text.md), and (Table ../2.1.Edit_mode/3.Tables.md).
  3. The Parameter widget displays the value of the Discount variable. Example screenshot 2
  4. The Text widget displays the value of the Discounted Price variable. Example screenshot 3
  5. The table shows product names and their prices. The Unit Price dimension has the Update Variable click action assigned. (Example screenshot 8 ../../images/bi_e_2_5_5.10.png)
  6. In the click action settings, the Discounted Price variable is selected. (Example screenshot 9 ../../images/bi_e_2_5_5.11.png)
  7. The Discounted Price variable updates using the formula "product"."Unit Price" * (1 - "inputs"."Discount"/100). (Example screenshot 4 ../../images/bi_e_2_5_5.6.png)
  8. To trigger the click action immediately upon clicking a product price, table filtering is disabled. (Example screenshot 7 ../../images/bi_e_2_5_5.9.png)
  9. Configuration is complete. Publish the dashboard. Set an arbitrary discount size, for example, 25%, and click any product price to execute the click action. (Example screenshot 5 ../../images/bi_e_2_5_5.7.png)
  10. The Discounted Price variable updates. (Example screenshot 6 ../../images/bi_e_2_5_5.8.png) -->

Click Action in YAML

To add a click action (UPDATE_VARIABLE), use the keys listed in the table. Specify these keys within the onClick block. Keys for the onClick block are described on the page Click Actions.

KeyTypeDefinition
variablesList of variables
namestringVariable name
inputMethodenumInput Method

Use the name and inputMethod keys inside the variables block. Example:

onClick:
  - type: UPDATE_VARIABLE
    name: Update Variable
    variables:
      - inputMethod: FORMULA
        formula: '"product"."Unit Price" * (1 - "inputs"."Discount"/100)'
        name: Discounted Price

Was the article helpful?

Yes
No
Previous
Open View
We use cookies to improve our website for you.