Skip to Content
0

How to use OData Date filter query to filter data from OData NetWeaver Gateway Service?

Jan 25 at 06:35 AM

342

avatar image
Former Member

Hello,

I am trying to use the OData Filter query. to filter data records from the OData Service, using Date range for filters.

Please check the below URL for the SAP's sample OData Service, with filter option.

Service Query URL :

https://orderdb.herokuapp.com/orders.svc/Orders?$filter=OrderDate%20eq%20datetime%272014-03-11T14:49:52%27

It gives out following error :->

<message xml:lang="en">Invalid filter expression: 'OrderDate eq datetime'2014-03-11T14:49:52''.</message>

Please let me know, if there is any mistake in the Query or is there anything that needs to be done on the
Backend Service.

Thanks & Regards,

Avish

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Ankit Maskara
Jan 30 at 05:54 PM
0

This works for me - "<OData service>....$filter=StartDate ge datetime'2017-04-15T00:00:00' and EndDate le datetime'2017-04-28T00:00:00' " provided the entity has StartDate and EndDate as Edm.Datetime properties. Same should work for you as well.

Share
10 |10000 characters needed characters left characters exceeded