Skip to Content
Jul 04, 2018 at 06:53 PM

xml view binding data from two entitysets


Dear Experts,

I am working on a Master-Detail app. I have a view with list control and I am binding the same with the data from an entityset called "entityset1".

Odata-> data from the entityset1

I do have another entityset called entityset2 in the same service.

Odata-> data from the entityset2

Data from above entityset2 will only be retrieved with the filter (/sap/opu/odata/sap/My_SRV/entityset2?$filter=(serialno=122333)

I am now trying to retrieve the value from the entityset2 and trying to bind it to one attribute in my list. This list is already binded with the entityset1 data.



Controller.js (binding using the below lines)

        });var oserialnum =this.getView().getBindingContext().getObject().serialno;var oHdata =new sap.ui.model.Filter("serialno","EQ",oserialnum);this.searchFilters =new sap.ui.model.Filter([oserialnum],true);this.oList.bindAggregation("items",{    
                    path :"/entityset2",   
                    filters :this.searchFilters

However I am getting an error "Cannot read property 'getObject' of undefined" on this line "this.getView().getBindingContext().getObject().serialno".

Can someone kindly advise how to retrive the data from the entity2 and binding it to the list, ?