Scripting > Expressions > Operators > Comparison operators > Equal to (=) operator
 
Equal to (=) operator
Numeric variables
visits = 3
The visits variable is a numeric (Long) variable that records the number of times respondents have visited the museum previously. The = operator compares whether the value in the variable is equal to 3. For example, you could use this expression to select respondents who have visited the museum exactly three times before.
Categorical variables
remember = {DINOSAURS, WHALES, HUMAN_BIOLOGY}
The remember variable is a multiple response (Categorical) variable that records which galleries respondents remember viewing. The = operator in this example compares the value in the variable with three specific categories and returns True if the variable contains all of these categories and no others, regardless of the order in which the categories are stored in the variable. For example, you could use this expression to select respondents who chose the Dinosaurs, Whales, and Human biology categories, and no others.
Text variables
side_main = "Main"
The side_main variable is a text variable that stores the text “Main” for respondents who entered the museum through the main entrance and “Side” for respondents who entered the museum through the side entrance. The = operator compares the value in the variable with the string “Main” and returns True when the variable contains an identical string. For example, you could use this expression to select respondents who entered the museum through the main entrance. Note that the comparison is case sensitive.
The above example shows how to use the operator in mrScriptBasic or mrScriptMetadata. In an SQL query, enclose the text string in ' ' (single quotation marks) and not " " (double quotation marks), like this:
side_main = 'Main'
Note When the comparison involves two NULL values, the expression returns True, regardless of the data type. This is because the UNICOM Intelligence Data Model uses the default SQL Server behavior, rather than the ANSI standard, which specifies that a comparison of two NULL values should return Unknown. See Null values for more information.
See
Comparison operators