Change Card Context with Button Component

Joined
Jun 30, 2022
Messages
4
Likes
0
Points
1
#1
In Cards there is the ability to quickly set the context between different values using the “Button” component. In this example we are adjusting the scenario and time period that the card is displaying.

This is specifically done through the “Set Context” property of the button. See below methods for setting the context using this property.

Context Setting - Basic
The method for setting context within this property simply follows the below formula:
  • [dimension]=[value]
A working example would be as follows:
  • Time=2022

Context Setting - Multiple Dimensions
To set multiple dimensions’ context 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]=[value]&[dimension2]=[value2]
A working example would be as follows:
  • Time=2022&Scenario=Budget

Context Setting - Dynamic
The context can also be set dynamically through the button rather than strictly through static values. By clicking the calculator icon on the property, the property editor opens. ELEMENT() values, VARIABLE() values and more are able to be parsed in through this editors.
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]=”&VARIABLE(”variable name”)
A working example would be as follows:
  • “Time=”&VARIABLE(”Time.Current Month”)

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 ensure to be wrapped in 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]=”&VARIABLE(”variable name”)&”&[dimension2]=”&VARIABLE(”variable name 2”)
A working example would be as follows:
  • “Time=”&VARIABLE(”Time.Current Month”)&”&Scenario=”&VARIABLE(”model.Budget Scenario”)
 

Attachments

Last edited: