Desktop User Guides > Quota Setup > Expression quotas > Defining expression quotas > Advanced expressions > Functions
 
Functions
There are many functions that you can use to define expression quotas based on values in categorical variables. The functions you are most likely to use for defining quotas are ContainsAny and ContainsAll for quotas based on subsets of responses from a multiple response list, and AnswerCount for quotas based on the number of responses chosen from a list.
For information about the many other functions that are available, see the Function Library documentation in the UNICOM Intelligence Developer Documentation Library.
See also
ContainsAny
ContainsAll
AnswerCount
Advanced expressions
Specifying expressions using the advanced method
Comparison operators in expression quotas
Logical operators in expression quotas
Arithmetic operators in expression quotas
Operator precedence in expression quotas
ContainsAny
Use the ContainsAny function to define a quota for respondents who have chosen any of a number of listed categories. The categories can belong to a single response variable, a multiple response variable, or a grid subvariable.
Syntax
<variable>.ContainsAny({<category1_id>, <category2_id>, ...})
The syntax uses the unique ID of the category rather than its label.
Example
You might define the quota expression for young people as:
age.ContainsAny({E1720_years, E2124_years})
This quota expression counts all respondents in the 17-20 years or 21-24 years categories.
Not ContainsAny
You can use the ContainsAny function in combination with the logical operator Not to define a quota for respondents who have not chosen any of a number of listed categories. The categories can belong to a single response variable, a multiple response variable, or a grid subvariable.
Syntax
Not <variable>.ContainsAny({<category1_id>, <category2_id>, ...})
For example, you might define the quota expression for all respondents who are older than 20 years of age as:
Not age.ContainsAny({E1116_YEARS, E1720_YEARS})
This expression selects all respondents except those in the 11-16 years or 17-20 categories.
See also
Functions
AnswerCount
ContainsAll
Use the ContainsAll function to create a quota for respondents who choose all of a number of listed answers for a multiple response question.
You can use ContainsAll with a single response variable, but do not specify more than one category. If you do, the expression will never select any respondents.
Syntax
<variable>.ContainsAll({<category1_id>, <category2_id> ...})
The syntax uses the unique ID of the category rather than its label.
Example
You can define a quota for respondents who regularly drink tea and coffee as follows:
drink.ContainsAll({Tea, Coffee})
Respondents who drink only tea, only coffee, or neither beverage are excluded from the quota.
All the listed answers and no others
You can use the ContainsAll function with the Exactly flag set to true to define a quota for respondents who choose all of a number of listed categories from a multiple response question and no others.
For example, you would define a quota for respondents who drink water and nothing else as:
drink.ContainsAll({Water}, True)
See also
Functions
ContainsAny
AnswerCount
AnswerCount
Use the AnswerCount function to define a quota based on the number of answers chosen from a multiple response list.
Syntax
<variable>.AnswerCount()<numeric_condition>
Example
To define a quota for respondents who can name more than five brands of fizzy drinks:
fizzy.AnswerCount() > 5
See also
Functions
ContainsAny