2
var dataURL = "urlTo .xsodata file";

var oModel = new sap.ui.model.odata.ODataModel(dataURL, true);
var products = new sap.ui.model.json.JSONModel();

oModel.read("/input('"+input+"')/Results/", null, null, true, function(oData){
products.setData(oData.results);
});

this.getView.setModel(products);

This is my .xsodata file

service napespace "_SYS_BIC"{
"calc View Name" as "PricingTool"
parameters via entity "input"
results property "Results";
}

I tried adding more entities with different names and calling those when I make the OData call but that didn't work. How can I update this to allow more parameters?

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
polaris
  • 339
  • 2
  • 14
  • 33
  • How do you add more entities? Are you using Batch-Processing? – matbtt Jan 11 '17 at 06:17
  • no I'm not. The the calc view takes different inputs, some being strings and some being integers. I thought that doing multiple lines like "parameters via entity "input" would work but that's clearly wrong. – polaris Jan 11 '17 at 13:47

1 Answers1

3

You can pass multiple parameters in an XSOData call by exposing parameters in the service declaration & then passing them in the service URL.

XSODATA

service 
{
    "viewpath/ViewName.calculationview"  as "PricingTool" 
    keys generate local "GENERATED_ID" 
    parameters via entity "PricingTool_InputParams" results property "Execute"
}

URL

/PricingTool_InputParams(ip_field1='A',ip_field2='B',ip_field3='C')/Execute
Stephen S
  • 3,936
  • 2
  • 23
  • 33