Scripting > Expressions > Operators > Comparison operators
 
Comparison operators
You use the comparison operators to compare values. For example, when you are building a filter you can compare the value in a variable with a specified value. The behavior of the operators depends on which types of variables are involved.
When a comparison operator is used to compare values of different data types, the Evaluate component automatically attempts to convert the values to the same data type. However, this is not always possible, and when it is, the results are not always sensible. The following table shows each combination of data types and the data type that the Evaluate component uses for the comparison.
The table is followed by examples of using the comparison operators. The examples are based on the variables in the Museum sample data set.
 
Double
Long
Text
Categorical
Date
Double
Double
Double
Double1
Not applicable
Double2
Long
Double
Long
Long1
Categorical
Date2
Text
Double1
Long1
Text
Categorical3
Date4
Categorical
Not applicable
Categorical
Categorical3
Categorical
Not applicable
Date
Double2
Date2
Date4
Not applicable
Date
1 Only if conversion from text to numeric is possible.
2 Operation occurs on the date's double value representation.
3 Only if conversion from text to long or categorical is possible.
4 Only if conversion from text to date is possible.
See
Equal to (=) operator
Not equal to (<>) operator
Less than (<) operator
Less than or equal to (<=) operator
Greater than (>) operator
Greater than or equal to (>=) operator
Operators