0
votes

I'm using an OData Model from my SAP Gateway:

var oModel = new sap.ui.model.odata.ODataModel(url);
this.setModel(oModel, "model");

Now I have the requirement to display a property from the first line of an EntitySet.

I tried it with the following code in my XML view but without success:

<Text text="{model>/ZLLEDATSet/0/Date}" />

I thought the syntax should be "modelname>/entitySet/index/PropertyName".

Based on the answer from @SiddP: I tried the following but I get the error

Uncaught [object Object]

<Text text="{ 
  path: 'model>/ZLLEDATSet',
  formatter: function(value) {
    return value[0].Date;
  }
}"/>
1
Does this answer your question? bindProperty to Single OData Entity - Boghyon Hoffmann

1 Answers

0
votes

Try this instead.

       text:{ 
            path: '/ZLLEDATSet', 
            formatter: function(value){
                           return value[0].Date;
                      }
            }

The above code in your question just works fine. See the jsbin :http://jsbin.com/kobocidose/edit?html,js,output

If you still get error just place alert(JSON.stringify(oModel.getData())); to check if the data is properly set to the model.There is a good chance the your data would show null.