Skip to main content
Question

How to use Object Variables

  • July 6, 2026
  • 1 reply
  • 437 views

andré.tafur
Level 8
Forum|alt.badge.img+19

Hi everyone!

I’m trying to use the object variables, but in the documentation it’s not clear how to set it up, define the keys and values and later use it in diferent components.

Can anyone give me a detailed tutorial please?

Regards

1 reply

abhishek.chatu14
Level 12
Forum|alt.badge.img+8

If I'm not mistaken, this can currently only be achieved using input variables, which can then be leveraged in dynamic charts.

I'm not sure if there's a way to define custom key-value pairs directly. It might be worth checking how the YAML is being populated, as that could reveal whether custom values can be introduced or extended.


gagan1
Member Spotlight
Forum|alt.badge.img+6
  • Member Spotlight
  • July 10, 2026

Hi ​@andré.tafur ,

Object variables are basically JSON containers you can create inside a Studio View. Here's the full walkthrough that may help you.

go to your View in edit mode, open the Variables menu, and create a new variable. Set the type to Object. In the default value field, define your keys and values as standard JSON ->

{
  "metric_name": "Total Spend",
  "pql": "SUM(\"EKPO\".\"NETWR\")",
  "target": 50000
}

To access individual properties in components or PQL, use dot notation with the variable syntax. If your variable key is MY_CONFIG, you'd write ${MY_CONFIG.metric_name} to get "Total Spend", or ${MY_CONFIG.target} to get 50000. This works in text components, PQL formulas, filters, and Smart Input fields.

 

The main use case is dynamic metric/dimension switching. You pair an Input Dropdown with the object variable, configure each dropdown option as a different JSON object (each with its own label/pql/target values), and bind the dropdown's "save selection to" your object variable. When a user picks a different option from the dropdown, the variable updates and every component referencing ${MY_CONFIG.pql} or ${MY_CONFIG.target} recalculates automatically.

 

One limitation to know: Input Dropdowns can only save to one variable at a time. So instead of trying to update five separate variables from one dropdown, pack everything into a single object variable and access the individual keys via dot notation. That's the whole point of using the object type over plain string/number variables.