Variables

Variables

A variable is an object that is used to reference values in Klips and on dashboards. Variables are closely associated with the User Input Control component. Variables tell the component what values to control using the drop-down menu.

An essential part of variables is the User Input Control component. Read this article to learn more.

To quickly learn about variables, watch the following video:

 Variables

Creating a new variable

When you create a variable, you need to provide two values: the Variable Name and the Klip Editor Value.

The Variable Name is what you select when working with Klips and acts as a placeholder or storage location.

The Klip Editor Value is the default value shown in a Klip when a variable is applied using a formula. This value may differ from what is shown on your dashboard.

To create a new variable

Create a variable by clicking the Klip Editor menu (beside the title of the workspace), or by clicking the variable button on the formula editing toolbar. Once you select the option to create a new variable, you will need to provide the Variable Name and the Klip Editor Value. When the variable is saved, it will be made available to everyone in your organization.

IMPORTANT: The Variable Name must start with a letter.  It can contain letters, numbers and underscores.


Using variables

Variables are an essential part of the User Input Control component. In order for the User Input Control component to function properly, you need to insert variables into other Klips on the same dashboard, or create a multi-component Klip that integrates with the User Input Control component and another component. This will depend on the property scope you have set for the User Input Control component.

To use variables in User Input Control (Scope)

Note: See this article to learn more about the User Input Control component and property scopes.

To use variables in a User Input Control component (Scope)

Note: These procedures assume you have already chosen to build a User Input Control component and are in the Klip Editor.

  1. Select the Drop-Down List component.
  2. Select a variable from the Variable's menu.
  3. Select Only this Dashboard from the Scope menu 
  1. Assign values to the Label component.

Note: The Label component provides the values to select from the drop-down list. Values select from the drop-down will be reflected in other Klips that use the same variables as the User Input Control component.

To assign variables to Klips on their corresponding dashboard

In order for the User Input Control to work, you will need to have some Klips on the same dashboard that use the same variable as in the Drop-Down List component. When you select a value from the drop-down menu, it will cause all Klips with same variable to show that value. For instance, if your labels are fruit names, and you have a Klip that uses the "Fruit" variable, then when you select Apples, all Klips with "Fruit" variables will show values based on your selection.

  1. Build a new Klip with a data source that related to the User Input Control component created in the above procedures.
  2. In the Klip Editor, assign the same variables as in the User Input Control component to the Klip.


  1. Save your Klip to add it to the dashboard.

How variables work on a dashboard

Klips that use the same variables as the User Input Control component will show values as specified by the selection you make in the drop-down list. If you apply a static selection (just the variable name), then selecting a value from the drop-down list will product the following results:


To use variables in a User Input Control component (Klip scope)

  1. Create a multi-component Klip that integrates the User Input Control component.
  2. Select the Drop-Down List component.
  3. Select a variable from the Variable's menu.
  4. Select Klip from the Property Scope menu.


  1. Assign values to the Label component.
  2. Assign the variable to a component in the other Klip style.


  1. Save the Klip to add it to the dashboard.

How variables work on a Klip

When you use the drop down menu to select a value in the multi-component Klip, this will affect the other components in the Klip. Other Klips on the dashboard will remain unchanged, even if they use the same variable.


In the image above, the drop down on the left is set to the Klip property scope. When value is selected in that Klip, only values within the Klip are affected, while other Klips on the dashboard remain unchanged (even if they use the same variable).

Using variable in dashboard titles

You can use variables in Klip and dashboard titles so that when you select a value from the drop-down menu, the title will also change. To use variables in a title, use curly brackets around the variable name. For example, to use the fruit variable in a title, type {fruit} in the title field.


Using a variable to filter data

In the examples so far, our data selections have all been static. With the SELECT function and variables, you can use the User input Control component to show data depending on the value selected. For example, the SELECT function will let you show numerical values associated with the testingvariable, such as current revenue figures for apple sales.

The below examples, use the following formula for the Values sub-component of the Drop-Down List in a User Input Control component.

  1. Use the Insert function button to insert the SELECT function.
  2. Select the data parameter and select the column of data that you want to return in your Klip.  For example, column B.
  3. Select the condition parameter and using the Insert variable button, select a variable that corresponds to the User Input Control component. For example, testingvariable.
  4. Click the ellipsis (...) and insert an equals (=) sign into the condition.
  5. Select the column containing the items of fruit into the condition.  For example, column A.  These items are also the selectable options in the Drop-Down List.

    Now, when the user selects Apple as a fruit type from the Drop-Down list, the Klip updates with the corresponding value from the data source.

Adding an All condition

In some situations, you might want to return all fruit types, as well as the individual fruit types. You can do this by using the OR function and specifying the "All" condition specified in the Values sub-component formula of the Drop-Down List User Input Control component.

  1. Select the ( before the variable in the above formula, and using the Wrap current value in function button select the OR function from the Logic menu.
  2. Select the condition parameter, use the Insert variable button to select the variable that corresponds to the User input Control component. For example, testingvariable.
  3. With the variable selected, use the Wrap current value in parenthesis button to wrap round brackets around the variable.
  4. Click the ellipsis (...) and insert an equals (=) sign into the condition.
  5. Using the Insert literal string or number button type the word All into the condition and click the Apply button.

To remove the column header from the returned result, select the column references in the overall formula, and use the Wrap current value in function button to select the SLICE function.

To learn more about filtering data using multiple conditions, see SELECT function - Common Scenarios.

Related links:

Feedback and Knowledge Base