Documentation Controls and Variables FAQs

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?

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.

Filter operators for strings
  1. First, edit the linked chart in Visual SQL by clicking Edit Chart Data from the chart’s ellipsis menu.
  2. 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, and TEXT_INPUT with the name of your Text Input Control.

    Text Input Control

  3. Once completed, you can click Run Query at the bottom of the SQL editor to make sure the syntax is correct.
  4. If everything runs without error, click Save to Dashboard to save the changes.

Filter with your Text Input

  1. Before you can start filtering for multiple values, look at your Text Input Control settings and make sure Multi-value is selected.
  2. 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.

  3. 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.

    Final Result