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.
Expression Tab
  • 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.
Variables 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.

In Dashboards:

You can create a variable map to get the desired output by controlling the variables. The created variable map is available in the Filter & Variable mapping Section with the Sub-heading called Variables. You can add a list of predefined values and also select a default value.
In edit view:
  • Click on three dots -> Filter & variable mapping -> Variables Tab
  • Click on "+ Variable mapping"
  • Name: Text field
  • Select Variables: In the Variable column, you need to select the variable which is to be included in the map.
  • Description: Text Box, description for the Variable Map
  • Dropdown Values List: Dropdown, list of predefined values for the Variable Map
  • Default Value: Dropdown, to select one from the list of defined values above
  • Allowed value- If picked "Is Any", then it will fetch the "Default Value". If picked "Predefined List", then you can input comma-separated values in "Value List". The list of values provided here is available as a drop-down for that variable on the dashboard.
  • Variable Mapping allows you to link together variables used from more than one model for the reports in the dashboard. And also to create a list of predefined values that can be selected by the users at the run-time to update the variable values.
  • On Dashboard, the variable Maps created are added below the filter maps and can be saved along with it in bookmarks