OR filter examples for Data Explorer
Once there’s at least one filter added to the Filters section in Interactive Mode, an OR button will appear below the Filter box. If you’d like your results to fit all filter conditions, add subsequent filters to the same Filters box. Any filters in this same field will have an AND operator between them.
If you’d like your chart to include results fitting different conditions, you’ll want to add them to a different Filters field using an OR filter. To do this, click the OR button and drag your column to the new Filters field.
Once you drag a column to the OR filter field, another OR button will appear beneath it. You may add as many OR boxes as you need this way.
Example 1
Our query results will include rows matching any of the following conditions:
- The Status contains the words “Signed” and “Prepared”. These can be in any part of the string since the term is wrapped in wildcards (
%
); - The Status contains the word “Uploaded”
- The Type is “pdf”.
Interactive Mode:
SQL:
where ("Status" like '%Signed%' and "Status" like '%Prepared%')
or
"Status" like '%Uploaded%'
or
"Type" = 'pdf';
Example 2
Our query results will include rows matching any of the following conditions:
- The Status is null;
- The Status is not “Unsigned” and is not “Canceled”.
Interactive Mode:
SQL:
where "Status" is null
or
"Status" not in ('Unsigned', 'Canceled');
Example 3
Our query results will include rows matching any of the following conditions:
- The Type is “pdf” and the Status includes the word “Signed”;
- The Type is “pdf” and the Status is not null.
Interactive Mode:
Because each section has an OR between it, we’ll need to do something a little different to get this to work in Interactive Mode: we’ll add our AND filter for Type to both OR sections. This will ensure that only results that have a Type of “pdf” AND either Status conditions will be included.
SQL Mode:
In SQL Mode, you can simply wrap the two OR conditions in parentheses to get the same results.
where "Type" = 'pdf'
and
("Status" like '%Signed%'
or
"Status" is not null)