Reporter > Filtering results > Advanced filter conditions > Examples: Creating complex filters using the Filter Syntax pane
 
Examples: Creating complex filters using the Filter Syntax pane
You can use the Filter Syntax pane to edit filters that you have set up using the Filter pane. In addition, you can create complex filter expressions that are not possible using the options available in the Filter pane. The following examples show how to create a number of complex filters.
Note If you create a filter using the Filter Syntax pane that it is not possible to create using the options in the Filter pane, the message: “The filter expression could not be displayed” appears the Filter pane when you click Apply. This is as expected, and does not prevent the filter from being applied to the table.
Include exactly these categories
To create a filter for the remember variable to include only people who remembered the Dinosaurs and Fossils galleries but no other galleries, use:
remember.ContainsAll({Dinosaurs,Fossils}, True)
The True parameter restricts the filter to respondents who chose Fossils and Dinosaurs and no other galleries.
To select respondents who chose both Fossils and Dinosaurs regardless of whether they chose any additional galleries, use the same syntax without using True (this option is equivalent to selecting Includes any of these in the Filter pane):
remember.ContainsAll({Dinosaurs, Fossils})
Include at least 2 of these categories
To include only people who remembered two or more of the Dinosaurs, Fossils, and Evolution galleries, regardless of whether they remembered other galleries, use:
remember.ContainsSome({Dinosaurs, Fossils, Evolution},2)
Include between 2 and 3 of these categories
To create a filter to include only people who remembered at least two, but no more than three, of the Dinosaurs, Fossils, Evolution, Birds, or Mammals galleries (regardless of which of the remaining galleries they remembered), use:
remember.ContainsSome({Dinosaurs, Fossils, Evolution, Birds, Mammals},2,3)
To exclude people who remembered any other galleries, add the True parameter:
remember.ContainsSome({Dinosaurs, Fossils, Evolution, Birds, Mammals},2,3, True)
Include at most 3 of these categories
To create a filter to include only people who remembered up to three of the Ecology, Wildlife in Danger, Botany, Conservation, or Fossils galleries (regardless of which of the galleries they remembered that are not on this list), use:
remember.ContainsSome({Ecology, Wildlife_in_Danger, Botany, Conservation, Fossils}, , 3)
To exclude people who remembered any of the other galleries not on this list, such as Dinosaurs or Whales, add the True parameter:
remember.ContainsSome({Ecology, Wildlife_in_Danger, Botany, Conservation, Fossils}, , 3, True)
Include only 1 of these categories
To include only people who remembered the Dinosaurs gallery but not the Fossils gallery, or the Fossils gallery but not the Dinosaurs gallery, regardless of which of the remaining galleries they remembered, use:
remember.ContainsSome({Fossils, Dinosaurs}, 1, 1)
To exclude people who also remembered any of the other galleries, add the True parameter:
remember.ContainsSome({Fossils, Dinosaurs}, 1, 1, True)
These examples use functions from the UNICOM Intelligence Function Library. See Function list for more information. See also Expressions and UNICOM Intelligence Function Library.
See also
Advanced filter conditions