In the expression editor, you can use Boolean logic to create the definitions for your constructions. We'll look at how these operators work and show an example.
In this article
1. Boolean Logic Operators
Boolean logic is used to calculate results that are either TRUE or FALSE. There are three basic logical operators: AND, OR, and NOT.
AND
The Boolean AND operator is used to confirm that two or more Boolean expressions are all true.
AND decreases the number of data records included.
Both conditions in an AND relationship must exist in at least one source, or no records will be included in the construction.
OR
The Boolean OR operator checks that either one condition or another is true.
OR increases the number of data records included.
Not all conditions in an OR relationship need to exist in any source for records to be included in the construction.
NOT
The Boolean operator NOT allows you to exclude items that are not relevant to your definition. It can sometimes be easier to exclude one item, rather then include many.
NOT is to be used with either AND or an OR operator.
The definition after NOT must include the axis name before the element name.
AxisName.("(ElementName1)" or "(ElementName2)") and not Axis_Name."(ElementName3)"
Brackets
Brackets are important to determine the order of calculation. With no brackets, the calculation is processed left to right. Adding brackets allows you to mix the Boolean operators and combine several items into one comprehensive definition.
2. Boolean Logic Example
Let's assume you want to create a new "Target Segments" axis with the following element:
Coast Focused Females = Females who visited a beach and a marine park/reserve but didn't visit a geothermal park, glacier, national park, or hot pools.
You have a combination of standard axes and elements with a series of Boolean operators in this case.
AxisName1.ElementName1 and AxisName2.(ElementName1 and ElementName2) and not AxisName2.(ElementName3 or ElementName4 or ... etc)
Where to from here?
Learn more about Constructions