This article describes how to create a Klip where you can type a name into a search field and then click a button to display only the data related to that name.
The end-result is a Klip that looks something like this:
Read on to see how we created the example above or watch this video for a similar example.
To create a Klip with a text search field, you:
- #1: Create the data source
- #2: Build the Klip
- #3: Associate the variable with the data source
- #4: Add the button component
Create the data source
First you need a simple data source. For our example, we created a .csv file that includes names and values, in two separate columns, and then uploaded it from our desktop.
To create a data source using an uploaded file:
- Click Data Sources in the left navigation sidebar.
- Click Create a New Data Source and select Upload a File.
- Click Browse and select a file to upload.
- Click Get data.
- Ensure this is the data you’re looking for and click Continue.
- Name and Save your data source.
- On the About this Data Source page, click Create a Klip.
Build the Klip
When building your Klip, you will add a User Input Control, that contains a variable, and a table.
To build your Klip:
- In the Klip Editor, drag and drop a User Input Control component (see below) into your Klip preview workspace. (This will become your search/text field in the finished Klip.)
- In the Properties panel:
- At Control Label, enter the action you want the user to perform. (We entered “Type a name”.)
- At Control Type, select Text Field from the drop-down options.
- At Use Variable, click New Variable.
- In the Create new variable window, enter a Variable Name (we used “find”) and a Klip Editor Value, where you enter one of the names from your data source (we chose the name “Renaldo” from our data source). (In step #3, where you associate the variable with your data source, this default value will display in the Klip preview.)
- Click Create Variable.
- In the Properties panel, at Scope, select Only this Klip from the drop-down options. Choosing this option ensures the variable will only be used for this Klip.
- Drag and drop a Table component into your Klip preview window, under the User Input Control you added earlier.
- To populate the table, click the first column in the table and then click the first column in your data source (the one that contains the names). Then click the second column in the table and click the second column in your data source (the one that includes the values).
- Remove the unnecessary third and fourth columns from the table by right-clicking each column and selecting Delete Column.
- Select each table column and, in the Properties panel, at Column Header, give them each a name. (We used “Sales Rep Name” for column 1 and “Sales” for column 2.)
- In the Properties panel, for the second column (“Sales”), at Results Row, click Sum.
Associate the variable with the data source
Next you will associate the variable you created earlier (“find”) with the text data in your data source.
To associate the variable with your data source:
- In the component tree, under Table, click the 3-dot menu beside the Sales Rep Name column and click Filter.
- In the Filter window, select Condition, and then choose either Matches or Contains (this varies depending on the data source you’re using) and select the variable name (“find”).
- Click Filter.
Note that the default name you entered earlier now displays in the Klip preview, as below.
Add the button component
As a final step, we will add the button component to the Klip and associate it with the user input control component you added earlier. Adding a button is important if you are using a large data source. Klipfolio performs a search every time you enter a character into the text box. However, if you add a button, the search only happens after the button is clicked, so the results are returned faster.
To add the button component and associate it with the user input control component:
- Drag and drop the Button component into the Klip preview window, under the text (“Type a name”) field.
- Note that, in the Properties panel, you can,optionally, override the default button background, border, and text colors.
- Select the User Input Control in the component tree.
- In the Properties panel, at Set Value, select On button press, and at Use Button, select Button.
- Click Save.
- Name and Save your Klip.
- Add the Klip to a dashboard. (After saving the Klip, you will end up on the Klips list page, where you can click the link for the Klip you just created, and then click Add to Dashboard).
- Test your Klip by entering a valid name into the text field and clicking the button to verify it returns the related data you expected.