# Case-sensitive filter

**URL:** <https://forum.wixstudio.com/t/case-sensitive-filter/38984>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [July 1, 2021, 5:30am UTC](https://forum.wixstudio.com/t/case-sensitive-filter/38984 "2021-07-01T05:30:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannywizbang](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@dannywizbang](https://forum.wixstudio.com/u/dannywizbang)\
**Post date:** [July 1, 2021, 5:30am UTC](https://forum.wixstudio.com/t/case-sensitive-filter/38984/1 "2021-07-01T05:30:40Z")

</div>

Just created my first coding (That works! yay) to filter a dataset. However the ‘search/filter’ seems to be case-sensitive. Is there a way to make this non case sensitive?

import wixData from ‘wix-data’ ;

$w . onReady (() =\> {  
$w ( ‘#searchBarInput’ ). onInput (() =\> filterDataset ());  
$w ( ‘#sortDropdown’ ). onChange (() =\> filterDataset ());  
})

function filterDataset () {  
let filter = wixData . filter ();  
let sort = wixData . sort ();  
let searchValue = $w ( ‘#searchBarInput’ ). value ;  
let sortValue = $w ( ‘#sortDropdown’ ). value ;

if ( searchValue . length \> 0 ) { filter = filter . contains ( ‘artist’ , searchValue ). or ( filter . eq ( ‘title’ , searchValue )) }

**switch** ( sortValue ) {

**case** ‘a-z’ :  
// Sort the products by their name: A - Z  
sort = sort . ascending ( ‘artist’ );  
break ;

**case** ‘z-a’ :  
// Sort the products by their name: Z - A  
sort = sort . descending ( ‘artist’ );  
break ;

**case** ‘titleAse’ :  
// Sort products by their price: Low - High  
sort = sort . ascending ( ‘title’ );  
break ;

**case** ‘titleDse’ :  
// Sort products by their price: High to Low  
sort = sort . descending ( ‘title’ );  
break ;  
}

```
$w ( '#dataset1' ). setFilter ( filter ). then (() => $w ( '#dataset1' ). setSort ( sort )); 

```

}

Thanks in advance  
Danny😊

---

<div class="post-metadata">

**Author:** ![yisrael-wix](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/yisrael-wix/32/1107_2.png) [@yisrael-wix](https://forum.wixstudio.com/u/yisrael-wix)\
**Post date:** [July 1, 2021, 5:49am UTC](https://forum.wixstudio.com/t/case-sensitive-filter/38984/2 "2021-07-01T05:49:34Z")

</div>

It looks like you have part of it right, this part is **not** case sensitive:

```javascript
filter.contains('artist', searchValue)

```

The documentation for contains states, Matching with contains() is not case sensitive, so “text” does contain “Tex”.

The other part however is case sensitive:

```javascript
filter.eq('title', searchValue)

```

The documentation for eq states, Matching strings with eq() is case sensitive, so “text” is not equal to “Text”.

Bummer. But all is not lost. You might be able to use contains() for that filter as well. Try it and see if that works for you.

The other option would be to do a non-filtered query, and then filter for your case-insensitive conditions in memory using Javascript.

---

<div class="post-metadata">

**Author:** ![dannywizbang](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@dannywizbang](https://forum.wixstudio.com/u/dannywizbang)\
**Post date:** [July 1, 2021, 6:14am UTC](https://forum.wixstudio.com/t/case-sensitive-filter/38984/3 "2021-07-01T06:14:22Z")

</div>

Yisrael you are my hero ! Works like a dream - once you see it it’s obvious 🕶
