v2.2.0
v2.2.0v2.1.0v2.0.0v1.2.0

# Operators

ActiveReportsJS `expressions` support the following types of operators. The operands of an operator could be expressions, such as references. This section describes the operators and contains examples of usage.

### Arithmetic operators

An arithmetic operator takes numerical values as its operands and returns a single numerical value.

• `+` : addition
• `-` : subtraction
• `*` : multiplication
• `/` : division
• `\` : the integer division operator discards the remainder left over when one operand is divided by a second operand.
• `^` : returns the result of raising the first operand to the power of the second operand.
• `Mod` : returns the remainder left over when one operand is divided by a second operand.

For example, the Get Started with Fixed Layout Reports Demo uses the following expression to calculate the invoice total.

``````{Sum(Quantity * UnitPrice * (1 - Discount))}
``````

### Comparison operators

A comparison operator compares its operands and returns a boolean value based on whether the comparison is true.

• `<` : returns `true` if the left operand is less than the right operand.
• `<=` : returns `true` if the left operand is less than or equal to the right operand.
• `>` : returns `true` if the left operand is greater than the right operand.
• `>=` : returns `true` if the left operand is greater than or equal to the right operand.
• `=` : returns `true` if the operands are equal.
• `<>` : returns `true` if the operands are not equal.
• `Is` : returns `true` is the left operand matches the right operand that can include regular characters and wildcard characters:
• `%` : any string of zero or more characters
• `_` : any single character
• `[ ]` : any single character within the range like `[a-c]` or set like `[faceod]`.
• `[^]` : any single character not within the range
• `Like` : returns `true` if both the left operand and the right operand are the same object references. It is useful to check whether a data set field value is `Null`. For instance, the Get Started with Banded Reports demo uses the following expression to display a placeholder picture is an employee does not have a photo

`{IIF(AvatarUrl Is Null, "https://demodata.grapecity.com/images/contoso/EmployeePhotos/no-photo.jpg", "https://demodata.grapecity.com" + AvatarUrl)}`

### String operators

The `+` and `&` operators concatenate two string values together, returning another string that is the union of the two operand strings. This is rarely needed with the interpolation syntax.

### Logical operators

Logical operators are used with `boolean` values.

• `And` : returns `true` if both operands are `true`
• `Not` : returns `false` if its operand is ``true` and vice versa
• `Or` : returns `true` if either operand is `true`
• `Xor` : returns `true` if one of its operands is `true`. Returns `false`, if both operands are `true` or `false`
• `AndAlso` : evaluates the left operand and if it is `false`, then stop processing and returns `false`. Otherwise evaluates the right operand and returns `true` if it is `true`.
• `OrElse` : evaluates the left operand and if it is `true`, then stop processing and returns `true`. Otherwise evaluates the right operand and returns `true` if it is `true`.

### Bitwise operators

A bitwise operator treats their operands as a set of bits rather than as decimal numbers.

• `<<` : shifts the left operand in binary representation to the number of bits specified in the right operand to the left, shifting in zeros from the right.
• `>>` : shifts the left operand in binary representation to the number of bits specified in the right operand to the right, discarding bits shifted off.