on 2017 Nov 09 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.
Request clarification before answering.
I am a bit late to the party but this exact problem happened to me before. It looks like a bug in the Filter constructor you are using:
new sap.ui.model.Filter(sPath, sOperator, vValue1, vValue2);
Try using the one with an object as a parameter:
new Filter({ path: "Price", operator: FilterOperator.BT, value1: 11.0, value2: 23.0 });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
34 | |
22 | |
15 | |
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.