Error in aggregation binding with odata v4 model when used on table with composite key
OpenUI5 version: 1.61.1-mobil
Browser/version (+device/version): Chrome Version 71.0.3578.98
Hello together, I am trying to bind a list to an odata v4 table with a composite key. The key consists of three attributes fkProfile, Weekday and MealNumber.
Here is an excerpt from metadata.xml
<EntityType Name="MealConfigs">
<Key>
<PropertyRef Name="fkProfile"/>
<PropertyRef Name="Weekday"/>
<PropertyRef Name="MealNumber"/>
</Key>
<Property Name="fkProfile" Type="Edm.Int64" Nullable="false">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`fkProfile`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="Weekday" Type="Edm.String" Nullable="false" MaxLength="1">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`Weekday`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="MealNumber" Type="Edm.String" Nullable="false" MaxLength="1">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`MealNumber`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="WeekdaySortOrder" Type="Edm.Int64" Nullable="false">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`WeekdaySortOrder`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="MealName" Type="Edm.String" MaxLength="45">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`MealName`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="MealEnabled" Type="Edm.Boolean">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`MealEnabled`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<Property Name="MealStartTime" Type="Edm.TimeOfDay" Precision="4">
<Annotation Term="teiid.NAMEINSOURCE">
<String>`MealStartTime`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="teiid.CASE_SENSITIVE">
<Bool>true</Bool>
</Annotation>
</Property>
<NavigationProperty Name="fkMealConfigToAccount" Type="my_nutri_diary.Account" Nullable="false">
<ReferentialConstraint Property="fkProfile" ReferencedProperty="idProfile"/>
</NavigationProperty>
<Annotation Term="teiid.NAMEINSOURCE">
<String>`MealConfigs`</String>
</Annotation>
<Annotation Term="teiid.UPDATABLE">
<Bool>true</Bool>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:ALLOW_MATVIEW_MANAGEMENT">
<String>false</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_ONERROR_ACTION">
<String>WAIT</String>
</Annotation>
<Annotation Term="my_nutri_diary.teiid_rel:MATVIEW_SHARE_SCOPE">
<String>NONE</String>
</Annotation>
</EntityType>
When I am now trying to bind to this list with the following code, I get an error: The xml looks as follows:
<List id="idMealConfigList" width="100%" binding="{/MealConfigs}" >
<items>
<CustomListItem class="mndTransparencyStyle sapUiContentPadding">
<HBox justifyContent="SpaceAround" alignItems="Center" class="sapUiTinyMarginTopBottom sapUiTinyMarginEnd">
<Input value="{MealName}" type="Text" width="135px"/>
</HBox>
</CustomListItem>
</items>
</List>
The error message:
sap-ui-core.js:180 2019-02-05 00:23:55.303600 Failed to drill-down into MealName, invalid segment: MealName - https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs?$select=MealName,MealNumber,Weekday,fkProfile sap.ui.model.odata.v4.lib._Cache
Has anybody a hint what I am doing wrong here, or how I can work around the issue. When I follow the link in the error message, I see the data as expected. Here is an example of the first two entries from the linked page in the error message:
<a:feed xmlns:a="http://www.w3.org/2005/Atom" xmlns:m="http://docs.oasis-open.org/odata/ns/metadata" xmlns:d="http://docs.oasis-open.org/odata/ns/data" m:context="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/$metadata#MealConfigs(fkProfile,Weekday,MealNumber,MealName)">
<a:id>
https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs
</a:id>
<a:entry>
<a:id>
https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='1')
</a:id>
<a:title/>
<a:summary/>
<a:updated>2019-02-04T23:29:08Z</a:updated>
<a:author>
<a:name/>
</a:author>
<a:link rel="edit" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='1')"/>
<a:link rel="http://docs.oasis-open.org/odata/ns/related/fkMealConfigToAccount" title="fkMealConfigToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='1')/fkMealConfigToAccount"/>
<a:link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/fkMealConfigToAccount" title="fkMealConfigToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='1')/fkMealConfigToAccount/$ref"/>
<a:category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#svc.1.my_nutri_diary.MealConfigs"/>
<a:content type="application/xml">
<m:properties>
<d:fkProfile m:type="Int64">2</d:fkProfile>
<d:Weekday>1</d:Weekday>
<d:MealNumber>1</d:MealNumber>
<d:MealName>strMeal</d:MealName>
</m:properties>
</a:content>
</a:entry>
<a:entry>
<a:id>
https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='2')
</a:id>
<a:title/>
<a:summary/>
<a:updated>2019-02-04T23:29:08Z</a:updated>
<a:author>
<a:name/>
</a:author>
<a:link rel="edit" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='2')"/>
<a:link rel="http://docs.oasis-open.org/odata/ns/related/fkMealConfigToAccount" title="fkMealConfigToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='2')/fkMealConfigToAccount"/>
<a:link rel="http://docs.oasis-open.org/odata/ns/relatedlinks/fkMealConfigToAccount" title="fkMealConfigToAccount" href="https://morpheus.fritz.box/odata4/svc/my_nutri_diary/MealConfigs(fkProfile=2,Weekday='1',MealNumber='2')/fkMealConfigToAccount/$ref"/>
<a:category scheme="http://docs.oasis-open.org/odata/ns/scheme" term="#svc.1.my_nutri_diary.MealConfigs"/>
<a:content type="application/xml">
<m:properties>
<d:fkProfile m:type="Int64">2</d:fkProfile>
<d:Weekday>1</d:Weekday>
<d:MealNumber>2</d:MealNumber>
<d:MealName>strMeal</d:MealName>
</m:properties>
</a:content>
</a:entry>
Thanks for your help! Best regards, Christoph
Hi @cjohn001, I've created an internal incident 1970112174. The status of the issue will be updated here in GitHub. Kind regards, Georgi
Hi @cjohn001,
we assume that the service data response for "/MealConfigs" in your application does not contain the property "MealName" for at least one of the entities in the collection returned. I suggest to check this in the JSON response for this request in your browser's dev tools.
Best regards, Patric
Hello Patric, thanks for your reply. I just double checked the response in JSON format. The response contains MealName in every returned record and also every record is initialized with the same string value. Hence, your assumption is unfortunately not met. Have you any further ideas and have you tried to reproduce the issue? Best regards, Christoph
Hello Christoph,
I was on the wrong track: the issue cause is that you use the collection "/MealConfigs" for an element binding on the List control via the "binding" property. An element binding must refer to a single object only, see https://openui5.hana.ondemand.com/#/topic/91f05e8b6f4d1014b6dd926db0e91070. In your case you want to set the List's items aggregation. Change your view to
<List id="idMealConfigList" width="100%" items="{/MealConfigs}" > ...
Best regards,
Patric
Hello Patric, thanks a lot for your help and sorry for this stupid question! It is working like you proposed.
Best regards, Christoph