本文介绍了OData url转换过滤查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有表DEPatientVisit和DEPhysician



我需要根据DEPatientVisit的StimulatorGourpId过滤数据。我为这个尝试了什么



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

例外:



它给出以下异常{odata.error: {code:,message:{lang:en-US,value:属性'StimulatorGourpId'的属性访问的父值不是单个值。属性访问只能应用于单个值。}}}



DEPatientVisit的响应没有嵌套值



{odata.metadata:localhost:33396 / FalconCPDataService.svc / $ metadata#DEPatientVisits,value:[{VisitID:f321edab-14c6-4ff2-9485-00abd176ebc4 PatientID: c588df3b-9ea4-439b-9ab6-968a793dad2b, StimulatorGroupID: b08d89e2-7dba-48ce-9430-282501397550, PhysicianID:空, 用户名:空, PainMapID:空VisitDate: 2014-02-19T10:18:42, VisitReason: usLro4OooDlMNJuWZHqeSXEKFwphz3Y9dvUr37RxHFz0h86aCImdsxUjuMWX64RG, 诊断: 7如果/ VTG / jeRgg0RjGp9Uzbi5iSglBgw59CwJKXcnk5E =, ClinicName:NULL, ECModel:空, ECSerial:null,ECType:null,ECFirmwarePN:null,Notes:,StimulationOnVAS:0.0,StimulationOffVAS:0.0,CRC:47851}

i试试这样



localhost:33396 / FalconCPDataService.svc / DEPhysicians?$ format = json&$ expand = DEPatientVisits&$ select = FullName,DEPatientVisits / Diagnosis,DEPatientVisits / Vi sitDate&$ filter = DEPatientVisits / any(v:v / VisitID + eq + guid%27F321EDAB-14C6-4FF2-9485-00ABD176EBC4%27)

但json的响应为null {odata.metadata :/ FalconCPDataService.svc / $ metadata#DEPhysicians&$ select = FullName,DEPatientVisits / Diagnosis,DEPatientVisits / VisitDate,value:[]}

解决方案



I have tables DEPatientVisit and DEPhysician

i need to filter the data based on StimulatorGourpId of DEPatientVisit. what i tried for this one

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

it gives following exception "{"odata.error":{"code":"","message":{"lang":"en-US","value":"The parent value for a property access of a property 'StimulatorGourpId' is not a single value. Property access can only be applied to a single value."}}}"

the reponse of DEPatientVisit there is no nested values

{"odata.metadata":"localhost:33396/FalconCPDataService.svc/$metadata#DEPatientVisits","value":[{"VisitID":"f321edab-14c6-4ff2-9485-00abd176ebc4","PatientID":"c588df3b-9ea4-439b-9ab6-968a793dad2b","StimulatorGroupID":"b08d89e2-7dba-48ce-9430-282501397550","PhysicianID":null,"UserName":null,"PainMapID":null,"VisitDate":"2014-02-19T10:18:42","VisitReason":"usLro4OooDlMNJuWZHqeSXEKFwphz3Y9dvUr37RxHFz0h86aCImdsxUjuMWX64RG","Diagnosis":"7if/VTG/jeRgg0RjGp9Uzbi5iSglBgw59CwJKXcnk5E=","ClinicName":null,"ECModel":null,"ECSerial":null,"ECType":null,"ECFirmwarePN":null,"Notes":"","StimulationOnVAS":0.0,"StimulationOffVAS":0.0,"CRC":47851}
i tried like this

localhost:33396/FalconCPDataService.svc/DEPhysicians?$format=json&$expand=DEPatientVisits&$select=FullName,DEPatientVisits/Diagnosis,DEPatientVisits/VisitDate&$filter=DEPatientVisits/any(v:v/VisitID+eq+guid%27F321EDAB-14C6-4FF2-9485-00ABD176EBC4%27)
but the response of json is null {"odata.metadata":"/FalconCPDataService.svc/$metadata#DEPhysicians&$select=FullName,DEPatientVisits/Diagnosis,DEPatientVisits/VisitDate","value":[]}

解决方案




这篇关于OData url转换过滤查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 01:07