cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Query

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

saivellanki
Active Contributor
0 Kudos

Try like this and check -



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

Regards,

Sai Vellanki

Former Member
0 Kudos

Hi Sai,

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

i tried above code suggested by you but still not getting data in table when i enter particular value in serach field .

console output

1.GET http://dev_sf1:08oct%402015@localhost:51923/AssetPro/proxy/http/10.35.20.16…     ATERIAL_SRV/CompanyCodeValuehelp?$filter=CompanyCode%20eq%20%200001/$count 400 (Bad   Request)

2.GET http://dev_sf1:08oct%402015@localhost:51923/AssetPro/proxy/http/10.35.20.16…?$skip=0&$top=105&$inlin... 400 (Bad Request)

3.2015-10-30 14:30:16 The following problem occurred: HTTP request failed400,Bad Request,{"error":{"code":"005056A509B11EE1B9A8FEA8DE87F78E","message":{"lang":"en","value":"Property 0001 not found in type CompanyCodeValuehelp"},"innererror":{"transactionid":"562820B4ACD475D0E10000000A2314A6","timestamp":"20151030085942.8365090","Error_Resolution":{"SAP_Transaction":"Run transaction /IWFND/ERROR_LOG on SAP NW Gateway hub system and search for entries with the timestamp above for more details","SAP_Note":"See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"}}}}

Regards,

Monika

Former Member
0 Kudos

In console output in query its taking value "0001" with message bad request but my table is not showing any filtered data in it.

code

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


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



console output

ATERIAL_SRV/CompanyCodeValuehelp?$filter=CompanyCode%20eq%20%200001/$count 400 (Bad   Request)


As you can see in query its taking value "0001" but table was not  filtered 



output screen





Code


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


when i am giving particular company code in my query and enter the same company code in search field and hit enter then table is getting updated 


Console output


GET http://dev_sf1:08oct%402015@localhost:51923/AssetPro/proxy/http/10.35.20.16…RIAL_SRV/CompanyCodeValu... 400 (Bad Request)


output screen



saivellanki
Active Contributor
0 Kudos

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.

saivellanki
Active Contributor
0 Kudos

Hi Monika,

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


Regards,

Sai Vellanki.