StezPet
StezPet

Reputation: 2450

Issue in creating ODATA Filter URL

I am trying to apply A & (B & C) operation in and ODATA url But it is not working as expected. Anyone please help us to solve my issue. I am providing my request url for your reference

https://xyz.abcd.com/company/events/_vti_bin/ListData.svc/MasterCalendar?$filter=CommunicationTypeValue eq 'Company Holiday' and (StartDate gt DateTime'2015-12-10T09:13:28' and StartDate lt datetime'2015-12 16T03:30:00.000')

But when I try to run it as individual queries it is working fine

like

https://xyz.abcd.com/company/events/_vti_bin/ListData.svc/MasterCalendar?$filter=CommunicationTypeValue eq 'Company Holiday'

https://xyz.abcd.com/company/events/_vti_bin/ListData.svc/MasterCalendar?$filter= StartDate gt DateTime'2015-12-10T09:13:28' and StartDate lt datetime'2015-12-16T03:30:00.000'

But when i try to combine these two issue starts.

Anyone please help me to solve this issue

Upvotes: 0

Views: 72

Answers (1)

Stephan Ronald
Stephan Ronald

Reputation: 1405

You Can apply filter using separate "AND" condition; Something similar to this,

MasterCalendar?$filter=(CommunicationTypeValue eq 'Company Holiday') and (StartDateTime ge datetime'2015-01-01') and (StartDateTime le datetime'2015-12-15')

Also you can use select case if needed for getting the specific dates.

Upvotes: 2

Related Questions