Skip to Content
avatar image
Former Member

Filter Query

oValueHelpDialog.getTable().bindRows("/CompanyCodeValuehelp?$filter=CompanyCode eq '0001'");

In this query i have passed hard coded value '0001'. Here I need to pass a variable.The variable contains value that is filled by user in form.

var aFilters = [];

    var sQuery = oEvt.getParameter("query");

    console.log(sQuery);

var oColModel = new sap.ui.model.json.JSONModel();

    oColModel.setData({

    cols: [

          {label: "Company Code", template: "CompanyCode"},

     {label: "CompanyCodeName", template: "CompanyCodeName"}

]

    });

    oValueHelpDialog.getTable().setModel(oColModel, "columns");

 

    oValueHelpDialog.getTable().setModel(sap.ui.getCore().getModel("oDataModel1"));

          

          oValueHelpDialog.getTable().bindRows("/CompanyCodeValuehelp?$filter=CompanyCode eq sQuery");

In this way I m trying to implement it. But it is not working.

Please guide me

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 30, 2015 at 08:06 AM

    Hi Monika,

    When you hard-code the value, binding is working?


    Regards,

    Sai Vellanki.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 30, 2015 at 08:11 AM

    Try like this and check -


    oValueHelpDialog.getTable().bindRows("/CompanyCodeValuehelp?$filter=CompanyCode eq " +sQuery+"");
    

    Regards,

    Sai Vellanki

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Monika,

      Try using filter parameter in aggregation binding and check -

      var oFilter = new sap.ui.model.Filter("CompanyCode","EQ",sQuery);
      oValueHelpDialog.getTable().bindAggregation("rows",{path:"/CompanyCodeValuehelp", filters:oFilter});
      
      

      Regards,

      Sai Vellanki.