Query operators
You can use the following list of operators in Sitecore query expressions:
| Operator | Description | Example | Return Value |
|---|---|---|---|
| Combination | //Products | ||
| + | Addition | 6 + 4 | 10 |
| - | Subtraction | 6 – 4 | 2 |
| * | Multiplication | 6 * 4 | 24 |
| div | Division | 8 div 4 | 2 |
| = | Equality | position() = 3 | True if position() is 3, otherwise False. |
| != | Not equal | position() != 3 | False if position() is 3, otherwise True. |
| < | Less than | position() < 4 | True if position() is less than 4, otherwise False. |
| <= | Less than or equal to | position() <= 4 | True if position() is less than or equal to 4, otherwise False. |
| > | Greater than | position() > 4 | True if position() is greater than 4, otherwise False. |
| >= | Greater than or equal to | position() >= 4 | True if position() is greater than or equal to 4, otherwise False. |
| or | Logical OR | position() = 3 or position() = 4 | True if position() is 3 or 4, otherwise False. |
| and | Logical AND | position() > 3 and position() < 7 | True if position() is greater than 3 and less than 7, otherwise False. |
| mod | Modulus (remainder of division) | 5 mod 2 | 1 |
If you have suggestions for improving this article, let us know!