Working with variables and text fields to build a pie chart

Variables work in conjunction with other components to add interactivity to a Klip. This example shows you how to create a pie chart of city scores by passing a single variable and using a text field to specify the country name. Although this example use the pie chart component, this concept can easily be used with other Klipfolio components.

Step 1: Building and configuring the user input control component

Goal: Create a variable to use with a text field.

  1. Select Build a New Klip.
  2. Select the User Input Control component.
  3. Select Don't use a data source option.
  4. From the component tree, select Klip, and type a Klip Title. For example, Country Selector.
  5. From the component tree, select Drop-Down List.
  6. At the Properties panel, provide the required information:

Location

Action

For our example

Control Label Enter a name for the text field list. Choose Country
Control Type Select Text Field.  
Create New Variable Enter an appropriate variable name. countryfilter
Default Value Enter a name for the default value. The default value displays when a user first signs-in or when the dashboard is refreshed. USA
Scope Set the scope to Dashboard. Set to dashboard, the selected variable influences all Klips on the dashboard where the Klip is located. Only this dashboard

Step 2: Building and configuring the pie chart

Goal: Use the SELECT function to create the labels and values sub-components.

For example,

SELECT ( C:C , ( countryfilter = A:A ) )

SELECT ( B:B , ( countryfilter = A:A ) )

  1. Select Build a New Klip.
  2. Select the Pie Chart component.
  3. Select Use an existing data source from the library option.
  4. Select the training sample data . For more information, see

    Upload our training data file

  5. From the component tree, select Klip, and type a Klip Title. For example, Scores by City.

Location

Action

For our example

  select the Values sub-component  
From the formula editing toolbar click Insert function, Data Manipulation, SELECT SELECT( data , ( condition ) )
With data selected select the column that contains the score results. SELECT ( C:C , (condition ) )
With condition selected. select Insert variable and select countryfilter. SELECT ( C:C , ( countryfilter ... ) )
With the first ... selected. select the equals operator SELECT ( C:C , ( countryfilter = ... ) )
With the first  ... selected. select the column that contains the country SELECT ( C:C , ( countryfilter = A:A ... ) )
  select the Labels sub-component  
From the formula editing toolbar click Insert function, Data Manipulation, SELECT SELECT( data , ( condition ) )
With data selected select the column that contains the cities. SELECT ( B:B , (condition ) )
With condition selected. select Insert variable and select countryfilter SELECT ( B:B , ( countryfilter, ...) )
With the first ... selected. select the equals operator SELECT ( B:B , ( countryfilter = ) )
With the first ... selected. select the column that contains the country SELECT ( B:B , ( countryfilter = A:A ) )

Tip: You can also create the Labels select statement by copying and pasting the Values select statement using the keyboard combination of Ctrl+C and Ctrl+V. However, remember to change the column reference from column C to column B.

Step 3: Troubleshooting tip

  • You can test a variable you have already created. In the user input control component, select the variable you want to test, and in the Klip Editor Value box, type in an expected value. For example, Canada.

Feedback and Knowledge Base