You might know that to create a drop-down list of options for a user to select and have the data automatically change in a Klip, you typically select a column of data from your data source in a User Input Control component, for example, a list of campaign names. But what if you want to add another option to this list. For example, in addition to a list of campaign names, you want the user to have the option to select only those campaign names that are active. How do you do this?
Let’s build a simple Klip to demonstrate adding the word Active to our drop-down list of options to only display those campaign names that are active.
Drag in a User Input Control component, and create a variable called campaign, and include the All data option. Consider changing the scope to Only this Klip from Only this dashboard.
For the values sub-component, use the ARRAY function so that you can type in the name Active and select column A, a list of campaign names, from your data source.
Array("Active",A:A;)
For the labels sub-component, use the keyboard combination of Ctrl+C and Ctrl+V, to copy this formula.
Click the three vertical dots alongside the labels sub-component and select Group to return a unique instance of each campaign name.
The following options are now displayed in the drop-down list.
All
Active
Campaign1
Campaign3
Campaign4
Campaign5
Drag in a Table component, and select your Campaign column from your data source for column 1, and select your values column for column 2.
To associate your User Input Control component to your Table, select the Table component and then from the Properties panel, select the option to Add Hidden Data.
This adds a Data sub-component to your Table component.
In the Data panel, use the SWITCH function to specify a formula for each drop-down selection.
SWITCH($campaigns,"Active",B:B;="Active","_default_",or(A:A;=$campaigns,"_all_"=$campaigns))
Select the three vertical dots beside the Data sub-component, select Filter, select TRUE, and select Filter.
This means that when a user selects a drop-down option then the formula associated with that option will be executed.
For example, if Active is selected, only campaign data marked as Active in column B is displayed in the Table.