Nesting Filters

Introduction

One of the most powerful tools in InfoView are the filters. Not only are they extremely flexible individually, they can also be combined together in more than one way. This is necessary when you have more than one set of criteria with which to define the rows of your report.

You can combine filters together with the following Boolean Operators and techniques:

  • AND
  • OR
  • Nesting

Nesting ANDs and ORs

AND

By default, InfoView combines your filters with a boolean AND.

Diagram showing boolean and

A Boolean AND returns only those results that satisfy both conditions at the same time.

You can see the AND in the filter box when you add more than one:

Screenshot of InfoView query filters with an AND operator

If you see an OR in this box and want to have an AND instead, double click on the word and it will change.

OR

InfoView supports combining filters with a Boolean OR.

Diagram showing boolean or

A Boolean OR states that all results need only satisfy one of the two conditions.

Note: Boolean ORs take longer to process, so your queries may take a little bit longer.

If you see an AND in this box and want to have an OR instead, double click on the word and it will change.

Nesting

InfoView supports using both ANDs and ORs within the same query. This technique is called nesting and is required when you have multiple but conflicting filters.

Example: Using Matches Pattern to find Buildings and also narrow the results by age

In this query, I want to retrieve only buildings that are young, for example those built in the last 20 years. I want to retrieve buildings with the word "Lab" in their name. I also want to retrieve the buildings with the word "Village" in their name.

If I use an "AND" for all of my filters, I would retrieve no results because there are no buildings under 20 years old whose names contain both the word "Village" and the word "Lab".

Screenshot of InfoView query filters with an AND operator

If I use an "OR" for all of my filters, I would retrieve too many results because I am retrieving all buildings with "Lab" in the name, all the buildings  with "Village" in the name as well as all of the buildings that have an age under twenty years. That would include many unwanted results, such as

Screenshot of InfoView query filters with an OR operator

I need to use the nesting technique to use a mix of ANDs and ORs for this query.

Screenshot of InfoView query filters with an AND operator and a nested OR operator

These filters will give me:

  • Buildings younger that 20 whose names contain the word "Lab"
  • Buildings younger than 20 whose names contain the word "Village"

This can also be written the following way: Buildings younger than 20 AND (Name contains "Lab" OR Name contains "Village")

This is a section of the results:

Screenshot of InfoView showing results of query with nested filter

To add an extra nested AND or OR, click on the small "nesting" button in the upper right hand corner of the filters box. As with the original AND and OR, double click on the word to change the operator.

Screenshot of InfoView showing location of nested filter button

Filters can now be added to the first operator or the second, as desired. They can be moved by clicking and dragging or by using the up and down arrows immediately to the left of the nesting button. You can nest as many ANDs and ORs as you like.