on 11-09-2017 1:42 PM
Hi,
Could anyone please help me understanding and resolving the below issue.
I have create the below filter to get suggestions
var value = oEvent.getParameter("suggestValue");
var filters = [];
if (value) {
filters = [ new sap.ui.model.Filter([
new sap.ui.model.Filter("Equipment",sap.ui.model.FilterOperator.Contains,value) ]) ];
}
the above code returns the following request
Equipment%20asc&$filter=(substringof(701744000,Equipment)) ... here i am missing the single quotes
But this will work if I explicitly pass single quotes in the above code like this
new sap.ui.model.Filter("Equipment",sap.ui.model.FilterOperator.Contains,"'"+value+"'") ]) ];
}
returns the below request
Equipment%20asc&$filter=(substringof(%27701744000%27,Equipment))
Now here is my total confusion with sap.ui.model.Filter...
there is a situation where model filter worked for me without passing explicit single quotes
the code looks like below
var sQuery = oEvent.getParameter("query");
new Filter("EquipmentNumber", FilterOperator.Contains, sQuery);
the request looks like below
EquipmentSet?$skip=0&$top=5&$orderby=EquipmentNumber%20asc&$filter=substringof(%27701744000%27,EquipmentNumber)
Could anyone please help me in understanding it.
value=""+value;
how about doing that before passing to the filter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response.
But why do we need to pass it before and how it makes the difference.
As i mentioned this code even works without passing single quotes
var sQuery = oEvent.getParameter("query");
new Filter("EquipmentNumber", FilterOperator.Contains, sQuery);
And one more strange thing today the below code works even without passing single quotes but not on the day i posted the question but please let me know in understanding the difference
new sap.ui.model.Filter("Equipment",sap.ui.model.FilterOperator.Contains,value) ]) ];
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.