This is a migrated thread and some comments may be shown as answers.

How to do a case-insensitive OData filter

1 Answer 3562 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dcadler
Top achievements
Rank 2
dcadler asked on 20 Feb 2020, 07:16 PM

I am using the DataSourceRequest.ToODataString() but the resulting request to my OData is case sensitive. I have seen examples of the $filter clause that uses the OData tolower method to give case-insensitive search.

 

For example, the following calls to me ASP.NET Core 3.1 / Microsoft.AspNetCore.Odata v7.3.0 API all return the same result set; 

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('eng'))&$top=2&$skip=0&$count=true

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('Eng'))&$top=2&$skip=0&$count=true

https://myapi/v1/accounts?$filter=contains(tolower(AccountName),tolower('eNg'))&$top=2&$skip=0&$count=true

Is there a way to modify your DataSourceRequest.ToODataString to support this type of client site modification so I can use it to do case-insensitive filters?

 

 

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 21 Feb 2020, 08:50 AM

Hello,

Would either of these approaches work for your case right now:

I am asking because at this point we don't have such a feature, but it looks like that heavily depends on the backend and database so using string operations might be the more flexible approach, and may let you use that right now as opposed to waiting for an implementation.

 

Regards,
Marin Bratanov
Progress Telerik

 UI for Blazor
Tags
Grid
Asked by
dcadler
Top achievements
Rank 2
Answers by
Marin Bratanov
Telerik team
Share this question
or