Building an expression
Anatomy of an expression
Expressions can be built using two types of elements: an expression element (sometimes called a 'leaf') and an expression tree object (called a 'node'):
An expression element (leaf) - used to define a single condition on an attribute. Elements cannot have any child elements
An expression tree object - containing a list of expression elements with a logic operator that's applied to that list (called a 'node'). Please note that the operator is applied to all elements on the list.
You should be aware that:
The expression tree object does not deal with attributes - instead it performs a logic operation on a collection of elements and / or other expression tree objects
If your expression has only one element in it (for example, just one attribute to filter or scope on), you should send a single expression element without the encompassing expression tree object (see below)
You can nest expressions to create a multi level tree, an expression tree object can have elements and other tree objects as operands.
Available expression operators
Available operators depend on whether you're dealing with an expression element or expression tree object.
Expression element (leaf)
The available operators are essentially SQL operators.
You can use following the operators:
Operator |
---|
Like |
== (equality) |
!= (inequality) |
> |
< |
>= |
<= |
Note
Not all operators work with all data types.
Expression tree object (node)
The only available logical operators are AND, OR and NOT.
Note
NOT is a unary operator and can only have one operand.