You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Oliver Grande (JIRA)" <ji...@apache.org> on 2018/02/28 14:53:00 UTC

[jira] [Commented] (OLINGO-1241) OData V4 How to filter nested properties

    [ https://issues.apache.org/jira/browse/OLINGO-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380414#comment-16380414 ] 

Oliver Grande commented on OLINGO-1241:
---------------------------------------

Hello Akash,

{{api/employers?$filter=addresses/city eq 'CityName' }}

is correct and shall return all employees with an address in _CityName_.

Regards,

Oliver

> OData V4 How to filter nested properties
> ----------------------------------------
>
>                 Key: OLINGO-1241
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1241
>             Project: Olingo
>          Issue Type: Question
>            Reporter: Akash Murthy
>            Priority: Blocker
>
> I have an OData entity model whose service metadata document description is as follows: 
> <EntityType Name="employers">
> <Key>
> <PropertyRef Name="rwemployerId"/>
> </Key>
> <Property Name="rwemployerId" Type="Edm.String"/>
> <Property Name="name" Type="Edm.String"/>
> <Property Name="addresses" Type="Collection(odata.atlas.EmployerAddressModel)"/>
> <Property Name="partnerName" Type="Edm.String"/>
> <Property Name="partnerCode" Type="Edm.String"/>
> </EntityType>
> <ComplexType Name="EmployerAddressModel">
> <Property Name="street1" Type="Edm.String"/>
> <Property Name="street2" Type="Edm.String"/>
> <Property Name="city" Type="Edm.String"/>
> <Property Name="state" Type="Edm.String"/>
> <Property Name="postalCode" Type="Edm.String"/>
> <Property Name="countryCode" Type="Edm.String"/>
> </ComplexType>
> So essentially, I have a parent entity called employers, which has a complex collection property called addresses whose type is EmployerAddressModel.
> I have implemented filtering of primitive types, based on the tutorial found here:
> [https://olingo.apache.org/doc/odata4/tutorials/sqo_f/tutorial_sqo_f.html]
> Currently, I can query by primitive type like so:
> api/employers?$filter=name eq 'Something'
> But what needs to be implemented to filter by 'city' property within the 'addresses' complex collection? 
> How would the url need to be formed for such as query? Should it be something like this? 
> api/employers?$filter=addresses/city eq 'CityName' 
> or 
> api/employers?$filter=addresses(1)/city eq 'CityName'
> This doesn't work at the moment, an answer to this would be greatly appreciated.
>  
> Thanks and regards,
> Akash



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)