Skip to content

Making Buttons change Context

Button components can be used to quickly update context.

This is specifically done through the Set Context property under the Interactivity section. See below methods for setting variables using this property:

1. Context Setting - Basic

The method for setting a dimension's context within this property simply follows the below formula: [Dimension Name]=[value]

A working example would be as follows: Time=2022

2. Context Setting - Multiple Dimensions

To set multiple dimensions with the same button, follow the above formula and concatenate with "&". The formula would be as below, and as many dimensions as desired can be concatenated in this way: [Dimension name]=[value]&[Dimension name 2]=[value2]

A working example would be as follows: Time=2022&Scenario=Budget

3. Context Setting - Dynamic

The dimensions can also be set dynamically through the button rather than strictly through static values. By clicking the pi icon on the property, the property editor opens. ELEMENT() values, VARIABLE() values and more are able to be parsed in through this editor.

The formula changes a bit in the regard that sections must be surrounded by double quotes and concatenated with the & symbol when joining on aforementioned dynamic portions (such as ELEMENT() and VARIABLE()). Setting the context of a single dimension would follow the below structure (using VARIABLE() as an example): "[Dimension name]="&VARIABLE("var-name")

A working example would be as follows: "Time="&VARIABLE("selected-time")

4. Context Setting - Dynamic Multiple Dimensions

Multiple dimensions can be set dynamically using a similar concatenation structure shown in the "Multiple Dimensions" section, adjusted slightly to fit the formatting required in the property editor shown in the "Dynamic" section.

The concatenation requires the "&" symbol, however this needs to be wrapped in double quotes alongside the ampersands outside of quotes that concatenate your dynamic values into the formula. As many dimensions as desired can be concatenated onto the formula following this structure (using VARIABLE() as an example):

"[Dimension name]="&VARIABLE("var-name")&"&[Dimension name 2]="&ELEMENT("var-name-2")

A working example would be as follows: "Time="&VARIABLE("selected-time")&"&Scenario="&VARIABLE("selected-scen")