HasAnswer
Identifies whether a specified category is in a category list.
This function has been superseded by
ContainsAll,
ContainsAny, and
ContainsSome. However, HasAnswer has been retained for backwards compatibility.
Syntax
HasAnswer(<value>, <answer>)
Parameter
<value>
Type: Categorical
Categorical value.
<answer>
Type: Long
Category to look for in <value>.
(return)
Type: Boolean
True if <value> contains the category, False otherwise.
Notes
If the current value is NULL, <value> is an empty Categorical value ({}) and the return value is False.
Examples
Function call
|
Response
|
Filter
|
Result
|
Q1.HasAnswer(Filter)
|
{4,2,9,6,1,7}
|
10
|
False
|
HasAnswer(Q1, Filter)
|
{4,2,9,6,1,7}
|
6
|
True
|
The following example selects respondents who chose the category with the mapped category value of 31 (which is the Dinosaurs category) in response to the remember question. In a multiple response variable, HasAnswer returns True regardless of whether any other category was chosen in response to the question. This example therefore selects all respondents who chose the Dinosaurs category regardless of whether they also chose any other category.
remember.HasAnswer(31)
See also