.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!



Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

OData and Numeric Comparison Filters In SharePoint

Posted By:Jean Paul       Posted Date: April 30, 2016    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

In this article we will explore Numeric Comparison filters of OData on SharePoint 2013 REST services.
 

In this article we can explore OData using Numeric Comparison filters.

Numeric Comparison Filters

Following are the Numeric Comparison filters available with OData

ltLess Than
leLess Than or Equals To
gtGreater Than
geGreater Than or Equals To
eqEqual To
neNot Equal To

Data Preparation

To proceed with the example I encourage you to create a Contacts list with a column named Age of type integer. Please fill some data appropriately.

clip_image002

eq Filter

Following is the example of using Equal filter where the column Age is equal to 30.

http://server/_api/Web/Lists/GetByTitle('Contacts')/Items?$filter=Age eq 30

The result was one list item as per my data.

clip_image004

clip_image006

Please note that uppercase (EQ) won't work.

ne Filter

Following is the example of using Not Equal filter where the column Age is not equal to 30.

http://server/_api/Web/Lists/GetByTitle('Contacts')/Items?$filter=Age ne 30

Obviously it returned a lot of items.

clip_image008

lt Filter

Following is the example of using Less Than filter.

http://server/_api/Web/Lists/GetByTitle('Contacts')/Items?$filter=Age lt 10

As there are no items with Age less than 10, my result was empty.

clip_image010

Similarly you can play with the remaining Arithmetic operators.

References

https://msdn.microsoft.com/en-us/library/gg309461.aspx

Summary

In this article we have explored Numeric Comparison filters of OData on SharePoint 2013 REST services.


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend