In Assette, expressions are powerful tools used within Data Objects and Data Blocks to manipulate, compare, and evaluate data for client reports and presentations. One of the essential comparison operators available is the >
Greater Than Operator. This operator allows you to compare two values to determine if one is greater than the other, enabling conditional logic and data filtering within your expressions.
This article provides a comprehensive overview of how the >
operator works in Assette expressions, including its purpose, syntax, usage examples, and practical applications.
Purpose of the >
Greater Than Operator #
The >
operator is used to compare two values or expressions to check if the left operand is greater than the right operand. It returns a Boolean result:
True
: If the value on the left side is greater than the value on the right side.False
: If the value on the left side is less than or equal to the value on the right side.
This operator is crucial for implementing conditional logic, making decisions within expressions, and filtering data based on numerical comparisons.
Syntax of the >
Operator #
value1
: The first value or expression to compare (left operand).
value2
: The second value or expression to compare (right operand).
value1 > value2
Understanding How It Works #
When you use the >
operator in an expression, Assette evaluates both value1
and value2
:
- If
value1
is numerically greater thanvalue2
, the expression returnsTrue
. - If
value1
is less than or equal tovalue2
, the expression returnsFalse
.
Note: The >
operator is typically used with numeric values but can also be used with dates to compare chronological order.
Examples of Using the >
Operator #
Numeric Comparison #
Evaluation:
10
is greater than5
.- Result:
True
10 > 5
Variable Comparison #
Assuming you have variables sales
and targetSales
:
Evaluation:
- Compares the value of
sales
totargetSales
. - Result:
True
ifsales
exceedstargetSales
; otherwise,False
.
sales > targetSales