Skip to Content
May 26, 2020 at 08:15 AM

Case insensitive search in UI5 oData filter


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,