Filter 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?

A few tweaks will be needed to your chart to set this up as lists can only include exact matches and wild cards are not compatible with “is one of” filters. Additionally, the “like” and “equals” options allow for only one value. You will then need to edit the SQL directly in SQL Mode to accommodate this type of filtering in SQL Mode.

customizing filters

To do this, open the Chart Editor using the Edit Chart Data option from the chart menu on your dashboard. Then switch your chart over to SQL Mode and edit the WHERE statement. You will need to insert the following to the statement:

"table_name"."column_name" LIKE any (array[{TEXT_INPUT}])

Simply replace table_name with your table name, column_name with your column name, and TEXT_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 Chart to save the changes.

The last step will be to customize your Text Input Control. In order to search the entire string in the email column, you will need to use wildcards %. In the Text Input fields on your dashboard, you will need to surround each search term you’d like to use as filters with percent signs, as shown in the example below:


customizing text input variable

You can keep adding more search terms by clicking on Add value under the current options in the Text Input and clicking on Update once completed. This will update the Text Input variable and filter your chart with the selected values.