[
https://issues.apache.org/jira/browse/OLINGO-1241?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16380651#comment-16380651
]
Akash Murthy commented on OLINGO-1241:
--------------------------------------
[~grande]
Thanks for the quick reply Oliver, but this simply isn't working. It's giving
me this message:
"The types 'Edm.Boolean' and 'odata.atlas.EmployerAddressModel' are not
compatible."
I don't really know what to make of this message. But I was under the
impression that since addresses is a collection, I can't access values inside
the collection directly by referencing addresses/city
I was doing a little bit of research and found that according to OData V4 spec,
the following needs to be called:
{{api/employers?$filter=addresses/any(a: a/city eq 'CityName')}}
Would you know how to implement such query parameters through Olingo?
> 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)