Filter using a Text Input with wildcards
What if you want to have a Text Input Control on your dashboard where you can enter a list of different search terms to filter your chart?
Your chart will need a few tweaks to set this up, as lists can only include exact matches and wildcards are not compatible with “is one of” filters. Additionally, the “like” and “=” options allow for only one value. You’ll need to edit the SQL directly in SQL Mode to accommodate this type of filtering.
1. Link the Text Input to your chart
- First, edit the linked chart in Visual SQL by clicking Edit Chart Data from the chart’s ellipsis menu.
-
Switch to SQL Mode and edit the WHERE clause with the following statement:
where "table_name"."column_name" LIKE any (array[{TEXT_INPUT}])
You would replace
table_name
with your table name,column_name
with the name of the column you want to filter, andTEXT_INPUT
with the name of your Text Input Control. - Once completed, you can click Run Query at the bottom of the SQL editor to make sure the syntax is correct.
- If everything runs without error, click Save to Dashboard to save the changes.
2. Filter with your Text Input
- Before you can start filtering for multiple values, look at your Text Input Control settings and make sure Multi-value is selected.
-
Now you can filter for multiple values with SQL wildcard patterns! For example, if you’re looking for a term but don’t care what’s before or after that term in the string (e.g., filtering for particular email domains), you can wrap the search term with the
%
wildcard as shown below:%searchterm%
Note: The other SQL wildcard characters should work as well.
-
You can add more search terms by clicking Add value under the last search term, then click Update once you’re done. Upon updating the Text Input, your linked chart will be filtered for the specified values.