Introduction
OData has now become a very popular way to communicate. In my previous post, we learned create OData services using ASP.NET Web API. As we saw, we can use filter expression in URIs to get the desired results. In this article we will learn more about the filter expression supported by OData.
As we know, keyword '$filter' can be added to end of URI to define filters. It is basically different from C/AL (Client/Server Application) expression. The main reason filter expression is different from C/AL expression is C/AL expressions are applied on Microsoft Dynamics NAV Server tier and filters are applied on Microsoft Dynamics NAV database tier.
With $filter operator, we need to pass property name and its value. The value must enclose in single quotes if value is string type and value must set to true and false for Boolean type.
The following Table contains Filter Expression supported by OData URI.



Points to remember while passing value to filter expression
- String value must passed in single quotation.
- Numeric value does not required any delimiters.
- Date time value must passed in single quotation and must preceded by the word "datetime" for example datetime'2016-04-25T05:16:43.1354695Z'.
Summary
Using filter expression in OData URIs, we can limit the data in result. In this article, I am trying to cover most of filter expressions supported by OData URI.


Maulik ModiPosted Jul 29, 2021, 2:24 AM EDT
Thanks for excellent reference. Somehow, I could not get SubstringOf working. Digging deeper when I checked OASIS standard, I could not see https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#_Toc31360982. Would you mind updating your article to reference what version of ODAta supports Substring?
Hemant Kumar SahuPosted Nov 27, 2017, 11:58 PM EST
Can I use 'In' operator?
Renish PatelPosted May 9, 2016, 12:05 PM EDT
Nice Article..Thanks for sharing this.
Rahul Kumar SaxenaTOP 100Posted Apr 27, 2016, 9:29 AM EDT
Good Show
Sonu ChaudharyPosted Apr 27, 2016, 4:02 AM EDT
good one :)
Bhuvanesh MohankumarPosted Apr 26, 2016, 11:02 PM EDT
Good one
Bhavik PatelPosted Apr 26, 2016, 6:20 PM EDT
nice
Debasis SahaTOP 100Posted Apr 26, 2016, 6:19 AM EDT
Nice One..
Vivek KumarPosted Apr 25, 2016, 10:54 AM EDT
Good one