Desktop User Guides > Quota Setup > Expression quotas > Defining expression quotas > Advanced expressions > Logical operators in expression quotas
 
Logical operators in expression quotas
When a quota definition is based on data from two or more variables, you define the overall expression by combining two or more sub-expressions using logical operators. Each sub-expression defines a single characteristic within the quota. For example, a quota for young men is a combination of a gender characteristic and an age characteristic.
Logical operators that join quota expressions are And and Or. The Not logical operator negates expressions.
And
Combine two sub-expressions with the And operator when you want to define a quota for respondents who satisfy both sub-expressions.
Syntax
The syntax is:
Expression1 And Expression2
Example
You would define a quota for young male respondents as follows:
gender.ContainsAny({MALE}) And age.ContainsAny({E1720_YEARS, E2124_YEARS})
This expression selects respondents whose gender is male and whose age is either 17-20 years or 21-24 years.
Or
Combine expressions with the Or operator when you want to define a quota for respondents who satisfy at least one of the sub-expressions.
Syntax
Expression1 Or Expression2
Example
To define a quota for men of all ages and all women between the ages of 17 and 24, specify:
gender.ContainsAny({MALE}) Or age.ContainsAny({E1720_YEARS, E2124_YEARS})
The gender expression selects all men and rejects all women. The age expression selects anyone aged 17 to 24 and rejects anyone outside that age range. A man passes the gender expression regardless of his age. A woman fails the gender expression but passes the age expression if she is in the specified age group.
Not
Use the Not operator when you want to define a quota for respondents who do not have a particular characteristic.
Syntax
Not Expression1
Example
To define a quota for male respondents who are not in the 17-20 or 21-24 age groups (that is, they are younger than 17 or older than 24):
gender.ContainsAny({MALE}) And Not age.ContainsAny({E1720_YEARS, E2124_YEARS})
See also
Advanced expressions
Specifying expressions using the advanced method
Comparison operators in expression quotas
Functions
Arithmetic operators in expression quotas
Operator precedence in expression quotas