How to disable case sensitivity on the fetch filter

#1

I would like to be able to have something similar to String Filter - disable case sensitivity. We are not using C3 UI framework, hence we are making API calls with the filter as contains(name, <user input>). Would it still be possible to have case insensitivity now?

1 Like
#2

You can use containsIgnoreCase expression function. Check documentation with

c3ShowFunc(ExpressionEngineFunction, 'containsIgnoreCase')

You can also combine contains with lowerCase functions to achieve same thing, e.g.:

c3Grid(Facility.fetch({
  filter: 'contains(lowerCase(name), lowerCase("jEn"))'
}))
1 Like
#3

Thanks. It was useful.

#4

If you don’t want to use the contains, you can use the lowerCase function for any string argument. For example:

lowerCase() = “abc”

Keep in mind that when doing case insensitive searching, indexes will not be used by the db, so they can/will be extremely slow on large datasets.

1 Like