Nested JSON in ODATA SAPUI5 mockup -
i using nested json file mockup data in odata sapui5 application, cannot access nested data.
json content
[{ "testcase": { "specification": "srs pr 28717 – deposit in brazilian reais", "execution": { "description": "desc", "bca_cn_acct_01": { "header": { "section": "field / section name", "data": "data enter / value select", "action": "activity / check / comment" }, "frame": { "id": 1, "title": "create account: initial screen", "data": [{ "key": "contract start", "value": "02/16/2000", "action": "" }, { "key": "contract manager", "value": "gh_ramoscl", "action": "" }, { "key": "product", "value": "br_ioftc3", "action": "" }, { "key": "account holder", "value": "gh_iof_cor", "action": "press enter" }] } } }, "result": "teste" }}]
in view file, want access data inside tag, list:
<core:view controllername="sap.ui.demo.mockserver.controller.app" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns="sap.m"> <!-- <list headertext="{i18n>headertext}" id="list" items="{/meetups}" nodatatext="{i18n>nodatatext}"> <items> <objectlistitem number="{ path: 'eventdate', type: 'sap.ui.model.type.datetime', formatoptions: { style: 'medium' } }" title="{title}"> <attributes> <objectattribute text="{description}"/> </attributes> </objectlistitem> </items> </list> <button press="onpressaction" text="{i18n>loadfirstitems}"></button> --> <list headertext="{i18n>headertext}" id="list" items="{/meetups}" nodatatext="{i18n>nodatatext}"> <items> <objectlistitem number="{ path: 'eventdate', type: 'sap.ui.model.type.datetime', formatoptions: { style: 'medium' } }" title="{testcase/execution/description}"> <attributes> <objectattribute text="{specification}"/> </attributes> </objectlistitem> </items> </list> <table id="table" items="{/meetups}"> <columns> <column width="12em"> <text text="field / section name"/> </column> <column minscreenwidth="tablet" demandpopin="true"> <text text="data enter / value select"/> </column> <column minscreenwidth="tablet" demandpopin="true"> <text text="activity / check / comment"/> </column> </columns> <items> <columnlistitem> <cells> <objectidentifier title="{testcase/execution/bca_cn_acct_01/frame/data/key}" class="sapmtablecontentmargin"/> <!-- <text text="{testcase/execution/bca_cn_acct_01/bca_dte_event_begin_d}" /> --> <text text="{testcase/execution/bca_cn_acct_01/frame/data/value}"/> </cells> </columnlistitem> </items> </table> <button press="onpressaction" text="{i18n>loadfirstitems}"></button>
however, data fields key , value not retrieved list, although array inside json data tag.
i use base sample tutorial sapui5 library: https://sapui5.hana.ondemand.com/#docs/guide/7a78f1b707c248fd9ec53dcb5f10814c.html
and below can find metadata file have been using:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <edmx:edmx version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:dataservices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:dataserviceversion="1.0"> <schema namespace="nerdmeetup.models" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2006/04/edm"> <entitytype name="meetup"> <complextype name="testcase"> <complextype name="execution"> <!-- create payment item --> <complextype name="bca_cn_acct_01"> <complextype name="header"> <property name="section" type="edm.string" nullable="false" /> <property name="data" type="edm.string" nullable="false" /> <property name="action" type="edm.string" nullable="false" /> </complextype> <complextype name="frame"> <property name="id" type="edm.int32" nullable="false" /> <property name="title" type="edm.string" nullable="false" /> <complextype name="data"> <property name="key" type="edm.int32" nullable="false" /> <property name="value" type="edm.int32" nullable="false" /> <property name="action" type="edm.int32" nullable="true" /> </complextype> </complextype> <property name="bca_dte_event_begin_d" type="edm.string" nullable="false" /> <property name="bca_dte_orgunit_cnmgt" type="edm.string" nullable="false" /> <property name="fspr_prodext_y" type="edm.string" nullable="false" /> <property name="bca_dte_bupa_acchold" type="edm.string" nullable="false" /> </complextype> </complextype> <property name="specification" type="edm.string" nullable="true" /> </complextype> </entitytype> <entitycontainer name="nerdmeetups" m:isdefaultentitycontainer="true"> <entityset name="meetups" entitytype="nerdmeetup.models.meetup" /> <functionimport name="findupcomingmeetups" entityset="meetups" returntype="collection(nerdmeetup.models.meetup)" m:httpmethod="get" /> </entitycontainer> </schema> </edmx:dataservices> </edmx:edmx>
any ideas?
hugs
i guess can either bind entire array:
{testcase/execution/bca_cn_acct_01/frame/data/}
or bind specific element of array:
{testcase/execution/bca_cn_acct_01/frame/data/0/key}
you use formatter receive array , concatenate keys of array check formatter sapui5 documentation
Comments
Post a Comment