Show/Hide Toolbars

TMS XData Documentation

The $filter query option can be used in a URI query string to specify a predicate by which entities will be filtered from an entity set. The $filter option only applies when addressing entity sets. The filter format is the following:


$filter=<boolean expression>


where <boolean expression> is a boolean expression with the predicate. Example:


http://server:2001/tms/xdata/Customer?$filter=Name eq 'John'


Properties can be accessed through their name, as in the previous example. The properties available are the ones from the entity type of the specified entity set. In the previous example, the entity set being retrieved contains instances of entity type Customer, which means properties of Customer are directly accessible in the boolean expression.


To access a property of an associated entity (navigation property), you can use slashes to build the path to the property name. The following example retrieves all customers which country is USA:


http://server:2001/tms/xdata/Customer?$filter=Country/Name eq 'USA'


You can use logical operators and parenthesis to define multiple expressions and change evaluation order:


http://server:2001/tms/xdata/Customer?$filter=(Name eq 'John' or Name eq 'Jack') and Country/Name eq 'USA'


The previous examples use string literals in the expressions. String literals are always defined using single quotes. You can have literals of other types in the expression. Since the filter query option is part of URL, you must always format the literals according to the rules defined in Literals in URI section.


The following table lists the operators supported in filter expressions, and the order of precedence from highest to lowest. Operators in the same category have equal precedence.







Enclosing parenthesis - expressions are evaluated with higher precedence



Slash, allowing access to a sub property (navigation property)



Negate x


not x

Logical not applied to x


x mul y

Multiplies x by y


x div y

Divides x by y


x add y

Adds x and y


x sub y

Subtracts y from x


x lt y

Evaluates true if x is lower than y


x gt y

Evaluates true is x is greater than y


x le y

Evaluates true if x is lower than or equal to y


x ge y

Evaluates true if x is greater than or equal to y


x eq y

Evaluates true if x is equal to y


x ne y

Evaluates true is x is not equal to y

AND Condition

x and y

Evaluates true is both x and y are true

OR Condition

x or y

Evaluates true is either x or y are true