Filter on a Text box input list with wildcards

Variables

What if you want to have a Text Input variable on your dashboard where you can enter a list of different search terms to filter your chart?

Well, lists can only include the exact matches, and you cannot use wild cards with the “is one of” filter. Additionally, the “like” and “equals” options allow for only one value. You would then need to edit the SQL in SQL Mode and customize your filters.

customizing filters

To do this, switch your chart over to SQL Mode and edit the WHERE statement. You will need to insert the following to the statement:

"_Users_"."_email_" iLIKE any (array[{_TEXT_INPUT_}])

You would replace “Users” with your table name,”email” with your field (column) name, and “TEXT_INPUT” with the name given to your Text Input variable. Once completed, you can hit Run Query at the bottom of the SQL editor to make sure the syntax is correct. Then, make sure to save your chart.

The last step is to customize your Text Input variable. In order to search the entire string in the email column, you will need to use wildcards. In the Text box on your dashboard, you will need to surround each search term you’d like to search with percent signs like in the example below.

%searchterm%

customizing text input variable

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


Related Variables Help Articles

See more