OData filter query [closed]

做~自己de王妃 提交于 2019-12-08 18:41:30
Tan Jinfu

OData v4 introduces a new operator 'any', which may resolve your scenario. Your request url would looks like:

~/FalconCPDataService.svc/DEPhysicians?$format=json&$expand=DEPatientVisits&$filter=DEPatientVisits/any(v:v/StimulatorGourpId+eq+guid%27F321EDAB-14C6-4FF2-9485-00ABD176EBC4%27)

For more please reference this:http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html, section 5.1.1.5.1 any

Thanks for inviting.

For the 1st query, your query target is entities in DEPhysicians? or DEPatientVisits? If want return entities in DEPhysicians, but inline expand navigation property DEPatientVisits, and want filter entities in DEPatientVisits with StimulatorGourpId. Try:

localhost:33396/FalconCPDataService.svc/DEPhysicians?$format=json&$expand=DEPatientVisits($filter=StimulatorGourpId eq guid'27F321EDAB-14C6-4FF2-9485-00ABD176EBC4')

For the 2nd query, Try:

localhost:33396/FalconCPDataService.svc/DEPhysicians?$format=json&$select=FullName&$expand=DEPatientVisits($select=Diagnosis,VisitDate;$filter=VisitID eq guid'F321EDAB-14C6-4FF2-9485-00ABD176EBC4')

All above query is following OData Protocol V4. $select and $filter can be inline $expand. But, I am not sure if it is implemented in odata4j. In sample service, the following are the similar query you can refer http://odatae2etest.azurewebsites.net/javatest/DefaultService/Orders?$expand=OrderDetails($select=OrderID;$filter=ProductID%20eq%206)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!