I have tables DEPatientVisit and DEPhysician

i need to filter the data based parameters

有帮助吗?

解决方案

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)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top