Skip to Content
0
Jun 22, 2020 at 12:46 PM

Issue with OData v4 and accessing 'deep' information

67 Views

Hi,

I try to show some data (OData v4) in a table (sap.m.Table) and currently I'm facing an issue accessing content provided in a collection within response structure. The service has a definition like:

<EntityType Name="SalesRequest">
   <Key>
      <PropertyRef Name="SalesRequestId" />
   </Key>
   <Property Name="SalesRequestId" Type="Edm.Int32" Nullable="false" />
   <Property Name="Status" Type="Edm.Int32" Nullable="false" />
   <Property Name="Positions" Type="Collection(RequestPosition)" />
</EntityType>

<ComplexType Name="RequestPosition">
   <Property Name="Position" Type="Edm.Int32" Nullable="false" />
   <Property Name="Material" Type="Edm.String" />
   <Property Name="Quantity" Type="Edm.Decimal" Nullable="false" />
</ComplexType>

How to bind a table cell to the first element returned in the Positions collection? The table should show something like:

/Postitions[0]/Material

What is the best approach to deal with embedded collections? I was not able to find a proper solution for this scenario:

* I tried to use a formatter, but binding a non-primitive type (the collection) is not possible

* I tried to use a sap.m.List as cell component, but the collection is not a valid list items aggregation

* ...

Any suggestions, links etc.? The OData service is provided by a third party (non-SAP) component.

Thanks.

Regards

Karsten