Search code examples
odataodata4j

Odata Url conversion with descending orderby


i need to get data by descending orderby Visidate of patient so i tried url like this

192.168.1.105:33396/FalconCPDataService.svc/DEPhysicians?$format=json&$expand=DEPatientVisits&$orderby=DEPatientVisits/VisitDate+desc

but showing exception

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


Solution

  • The reason is that DEPatientVisits is not a single valued navigation property, so it is unable to append a property name to it. If it is a single valued, it works fine, such as:

    http://services.odata.org/v4/OData/OData.svc/Products?$expand=Supplier&$orderby=Supplier/Name