question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Case insensitive filter

See original GitHub issue

It would be nice if the ODataModel filter would support case insensitive filtering besides the current default filtering. When this case insensitive filtering would be used, instead of e.g.

People?$filter=substringof(%27Smith%27,FullName)

The following filter would be used:

People?$filter=substringof(tolower(%27Smith%27),tolower(FullName))

You could think of e.g. implementing this using an additional set of operators, perhaps pre- or postfixed with an “I” to indicate they’re case-insensitive:

var filter = new Filter("FullName", FilterOperator.ContainsI, "smith");

and

var filter = new Filter("FullName", FilterOperator.EQI, "smith");

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:9
  • Comments:17 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
Michadeliccommented, Sep 14, 2016

Hello Jan,

good idea, it has been requested a lot of times already and it seems to be a missing feature in the odata specification. While we could add new filter operators in the odata model itself, the standard would not support it.

There are two very common workarounds:

  • apply str.toLower() on the client
  • implement the filter operation on the backend side case-insensitive

See also typical posts about this on goolge: https://www.google.de/search?q=odata+case+insensitive+search&oq=odata+case+insen&aqs=chrome.2.69i57j0l5.4601j0j1&sourceid=chrome&ie=UTF-8

Nevertheless i will forward your request to the OData experts so that they can take your enhancement as input and follow up with you.

Kind Regards, Michael

5reactions
StErMicommented, Aug 1, 2017

Hi @gregorwolf I can confirm that with our actual project we’re folliwing that example.

Here’s how to create the filter

createFilter: function(key, value, operator, useToLower) {
	return new Filter(useToLower ? "tolower(" + key + ")" : key, operator, useToLower ? "'" + value.toLowerCase() + "'" : value)
},
Read more comments on GitHub >

github_iconTop Results From Across the Web

ES6: Filter data with case insensitive term - javascript
You can use a case-insensitive regular expression: // Note that this assumes that you are certain that `term` contains // no characters that ......
Read more >
How to Create Case-Insensitive Prompts and Filters - IBM
A query filter may be case-sensitive depending on the collation set defined on the database. The database collation determines whether a prompt ...
Read more >
JavaScript filter an array of strings, matching case insensitive ...
JavaScript filter an array of strings, matching case insensitive substring? - Let's first create array of strings −let studentDetails ...
Read more >
Perform a Case Sensitive Filter in Excel – - Excel Training
Running a Case Sensitive Filter Using Advanced Filter · 1) Click in any single cell in your database · 2) Click on the...
Read more >
Case Insensitive Filtering Using Power Query - MyExcelOnline
Case Insensitive Filtering Using Power Query or Get & Transform · STEP 2: Go to Data > Get & Transform > From Table...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found