cancel
Showing results for 
Search instead for 
Did you mean: 

How do we bind OData through functions in V4

We have a JSON response in the below format:

{
"@odata.context": "$metadata#Collection(Benefit.SubCategoryItems)",
"value": [
{
"subCategoryId": "SC01",
"subCategoryDescription": "Leave Types",
"benefitItems": [
{
"groupId": "SAPTEST",
"categoryId": "C01",
"benefitId": "01",
"subCategoryId": "SC01",
"categoryName": "My Leaves and Vacation",
"categoryDescription": "Leaves and Vacation",
"categoryIcon": null,
"benefitName": "Privilege Leave",
"benefitDescription": "Take 21 days of well-deserved break to spend more time for yourself and with your family",
"benefitLink": "https://one.int.sap/me@sap/vacation_and_absences",
"benefitKeywords": "privilege;leave",
"subCategoryName": "Leave Types",
"subCategoryDescription": "Leave Types",
"sequence": 1
},
{
"groupId": "SAPTEST",
"categoryId": "C01",
"benefitId": "20",
"subCategoryId": "SC01",
"categoryName": "My Leaves and Vacation",
"categoryDescription": "Leaves and Vacation",
"categoryIcon": null,
"benefitName": "Illness Leave",
"benefitDescription": "Be nursed back to health with up to 12 days of medical leave",
"benefitLink": "https://one.int.sap/me@sap/vacation_and_absences",
"benefitKeywords": "leave;illness",
"subCategoryName": "Leave Types",
"subCategoryDescription": "Leave Types",
"sequence": 2
},
{
"groupId": "SAPTEST",
"categoryId": "C01",
"benefitId": "42",
"subCategoryId": "SC01",
"categoryName": "My Leaves and Vacation",
"categoryDescription": "Leaves and Vacation",
"categoryIcon": null,
"benefitName": "Service to Nation Leave",
"benefitDescription": "SAP supports your commitment to serve your country, you may use up to 90 days for your Service to Nation Leave",
"benefitLink": "https://one.int.sap/me@sap/vacation_and_absences",
"benefitKeywords": "leave;nation;service",
"subCategoryName": "Leave Types",
"subCategoryDescription": "Leave Types",
"sequence": 3
}
]
},
{
"subCategoryId": "SC04",
"subCategoryDescription": "Core Benefits",
"benefitItems": [
{
"groupId": "SAPTEST",
"categoryId": "C02",
"benefitId": "B03",
"subCategoryId": "SC04",
"categoryName": "Flexben",
"categoryDescription": "Flex Benefits",
"categoryIcon": null,
"benefitName": "Medical Insurance",
"benefitDescription": "Medical Insurance Policy provides insurance cover for SAP employees and their dependents",
"benefitLink": "https://one.int.sap/me@sap/benefits/group_insurance",
"benefitKeywords": "medical;policy;insurance",
"subCategoryName": "Core Benefits",
"subCategoryDescription": "Core Benefits",
"sequence": 3
}
]
}
]
}

We are trying to bind this data in SAP UI5 through the following code:

 <tnt:NavigationList items="{path: 'mMaster>/getBenefits()'}">
<tnt:NavigationListItem text="{mMaster>subCategoryDescription}" icon="sap-icon://circle-task2" select="fnOnNavList" expanded="false" items="{mMaster>benefitItems}">
<tnt:NavigationListItem text="{mMaster>benefitId}" select="fnOnNavListItem"/>
</tnt:NavigationListItem>
</tnt:NavigationList>

The binding gives the subCategoryDescription correctly. But it fails while trying to bind benefitItems, benefitId.

Is there any way out to bind the data?
The output comes as below:

And console logs the below error:

Thanks in Advance.

Ashi

Accepted Solutions (0)

Answers (0)