Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OData - filter by nested property

Tags:

odata

does anyone know how to express an OData $filter against a nested property?

for ex. I have the following Atom entry,

<entry>
...
 <m:properties>
...
  <d:RegardingObjectId m:type="Microsoft.Crm.Sdk.Data.Services.EntityReference">
  <d:Id m:type="Edm.Guid">3f3712fd-fc49-e211-8eb8-000c296272c8</d:Id> 
  <d:LogicalName>new_sportsleague</d:LogicalName> 
  <d:Name>Boca</d:Name> 
  </d:RegardingObjectId>

I want to filter for those entries that have RegardingObjectId/LogicalName eq 'new_sportsleague'.

Tried with 'RegardingObjectId/LogicalName' and 'RegardingObjectId.LogicalName' with no luck.

like image 252
Ariel Avatar asked May 15 '13 16:05

Ariel


1 Answers

'RegardingObjectId/LogicalName' would be the correct syntax.

For example:

http://services.odata.org/v3/OData/OData.svc/Suppliers

returns two results, whereas

http://services.odata.org/v3/OData/OData.svc/Suppliers?$filter=Address/Street eq 'NE 228th'

returns just one.

I don't see a place in the OData spec that explicitly states whether filtering using properties of a complex value is legal or not, but it seems that WCF Data Services supports it. It could be that other OData implementations don't.

like image 106
Jen S Avatar answered Oct 07 '22 19:10

Jen S