Manipulate Data in the Cloud: ADO.NET Data Services Framework Arithmetic, Logical, and Grouping Filters: Table 2: Apply Arithmetic, Logical, and Grouping Operators as URI Filters.

URI filters correspond to restructured SQL WHERE clauses or LINQ Where query operators. Abbreviations replace arithmetic and logical symbols, which aren't valid in URIs. Use logical or and and operators for compound filters, and apply precedence grouping operators to segment operations. The .../ abbreviation represents the service prefix, such as http://localhost:52660/Northwind.svc/. Italic text is part of the URI query.

Operator Description Example
Arithmetic Operators
add Addition (+) .../Products?$filter=UnitPrice add 10 gt 25
sub Subtraction (-) .../Products?$filter=UnitPrice sub 10 gt 25
mul Multiplication (*) .../Orders?$filter=Freight mul 40 gt 1000
div Division (/) .../Orders?$filter=Freight div 10 eq 5
mod Modulo (%) .../Orders?$filter=Freight mod 10 eq 0
Logical Operators
eq Equal (=) .../Orders?$filter=ShipCountry eq 'USA'
ne Not equal (!= or <>) .../Orders?$filter=ShipCountry ne 'USA'
gt Greater than (>) .../Orders?$filter=UnitPrice gt 100
ge Greater than or equal (>=) .../Orders?$filter=Freight ge 100
lt Less than (<) .../Orders?$filter=Freight lt 100
le Less than or equal (<=) .../Product?$filter=UnitPrice le 50
and Logical and (&&) .../Product?$filter=UnitPrice le 50 and UnitsInStock gt 10
or Logical or (||) .../Product?$filter=UnitPrice le 50 or UnitsInStock gt 10
not Logical negation (!) .../Customers?$filter=not endswith(PostalCode,'50')
Grouping Operators
( ) Precedence grouping .../Product?$filter=(UnitPrice sub 5) gt 10
comments powered by Disqus
Most   Popular
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.