odatasapui5hana-xs

How to pass in multiple parameters as entity on xsodata call?


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?


Solution

  • 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