Sprinkle Docs
Search
K
*️

Variables

Feature walkthrough on Sprinkle models, reports, and dashboards. Includes step-by-step process to select or input the values for variables at the run-time and to get the desired result

In Models:

Variables are defined at Model-level so that they can be used in any expression that is being created at the Mode-level. The list of all the variables defined for the Model is available in the variables section. You can edit/delete/add new variables to the list.

How to create variables in models

  • Model -> Expressions Tab -> Expressions
  • Click on add Expression.
  • The expression box can be used to define a dimension/measure expression
  • Variables can be created by clicking on add variable button.
  • You can see the output in the preview box after clicking on the “Validate” button. It shows the output of the expression applied on the first 5 rows of data.
Model -> Expressions Tab -> Variables:
  • You can create new variables here(as shown below). This section also shows all the defined variables at the Model level, along with options to make edits and delete variables.
  • A variable defined in the variable section becomes a global variable in the context of that model, meaning that the variables can be used within any of the expressions in the same Model.
Variable Section

In Reports

The run-time value of the variables defined at the model level can be edited on the Reports-Edit Tab to get the desired output.
In edit view:
  • The created variables can be seen in the left-hand side panel, where you can now find a tab with a variable icon along with Dimension and measure tabs.
  • On Clicking the Edit icon on the created dimension/measure or the Variable icon, the variable section opens up.
  • The value of the variable can be controlled in real-time (as shown below). The value edited and saved only applies to the Report and does not override the default value of the variable at the Model level.
Adding variables in report