0

I'm using element binding in XML to get data from an OData service in the controller:

{myModel2>/oData/ProdOrdSet('123456789')/Gmein}

The whole thing should now work with dynamic numbers instead of 123456789. I started with the following approach:

{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

So another JSON Model and another element in the first. Unfortunately this did not work, kindly help?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • Try using {myModel2>/oData/ProdOrdSet('{= ${myModelLD>/Aufnr}}')/Gmein} (not tested, see expression binding in the SAP documentation) – Lumpenstein Oct 09 '19 at 07:46
  • Do you only want to show exactly one entry? Or do you want to use this binding as a part of an aggregation binding? – Voyager Oct 09 '19 at 08:07

1 Answers1

0

Try to get the ID in a local variable and form the binding path to bind. Instead of this

{myModel2>/oData/ProdOrdSet('{myModelLD>/Aufnr}')/Gmein}

try binding as below:

var id = getModel("myModelLD").getProperty("/Aufnr");
var sPath = "myModel2>/oData/ProdOrdSet('"+id+"')/Gmein";
this.getView().bindElement(sPath);
Saddamhussain
  • 860
  • 5
  • 14