on 05-26-2020 9:15 AM
Dear Community,
I am trying to do a case-insensitive search by passing in the following way :-
oData Filter :
$filter= substringof( "query" , tolower(Vendor_name))
In ui5 i tried to build the filter in the following way :-
new Filter("tolower(Vendor_name)", FilterOperator.Contains, "query" )
Generated oData Query :
$filter= substringof( query, tolower(Vendor_name))
// without the double quotes and which results in the error Invalid filter expression
I tried to append single quotes :-
new Filter("tolower(Vendor_name)" , FilterOperator.Contains, " ' " + "query"+ " ' " )
Generated oData Query :
$filter= substringof( 'query' , tolower(Vendor_name))
// with the single quotes and search is working fine but with console Assertion error
Error: assert-dbg.js:34
Assertion failed: PropertyType for property tolower(Document_no) of EntityType Record not found!
Is this a bug , or this is not the right way to use it ?
What is the best way to do in case of case insensitive search in UI5 ?
Thanks and regards,
Bibhu
https://ui5.sap.com/1.78.0/#/api/sap.ui.model.Filter
The filter has a 'caseSensitive' parameter, maybe this can help you?
with 'caseSensitive: true' the query would look like this:
?$filter=substringof(%27vinet%27,CustomerID)
if we set it to false:
?$filter=substringof(%27VINET%27,toupper(CustomerID))
var oFilter = new Filter({
path: "CustomerID",
operator: FilterOperator.Contains,
value1: sQuery,
caseSensitive: false
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @jordanvde
Always loved to see how SAP community responds faster than any channel 🙂
User | Count |
---|---|
84 | |
11 | |
10 | |
8 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.