Scripting > UNICOM Intelligence Function Library > Categorical functions > HasAnswer
 
HasAnswer
Identifies whether a specified category is in a category list.
Syntax
HasAnswer(Val, Answer)
Parameter
Val
Type: Categorical
Categorical value.
Answer
Type: Long
Category to look for in Val.
(return)
Type: Boolean
True if Val contains the category, False otherwise.
Remarks
If the current value is NULL, Val is an empty Categorical value ({}) and the return value is False.
The HasAnswer function has been superseded by ContainsAll, ContainsAny, and ContainsSome. However, HasAnswer has been retained for backwards compatibility.
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
Categorical functions