# Filtering data with AND and OR

**URL:** <https://community.glideapps.com/t/filtering-data-with-and-and-or/78503>\
**Category:** Ask for Help\
**Created:** [December 10, 2024, 8:43pm UTC](https://community.glideapps.com/t/filtering-data-with-and-and-or/78503 "2024-12-10T20:43:22Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![gvalero](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/gvalero/32/1037_2.png) [@gvalero](https://community.glideapps.com/u/gvalero)\
**Post date:** [December 11, 2024, 1:51pm UTC](https://community.glideapps.com/t/filtering-data-with-and-and-or/78503/7 "2024-12-11T13:51:36Z")

</div>

Hola Martín,

When this case gets complicated due to new conditionals appearing, I prefer to use this short JS code to handle the logic and use the value “true” as a filter parameter in Glide components.  
Something like this:

```auto
 if ((p1 == "EXPENSE") && (p2 == "yourRowID" || p2 == "")) 
     return true

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/d/f/df791debf7bdabbf0ff9386d85f7d5c8a9625a71.png)

just play with the conditional AND (&&) / OR (||) by putting your cases in the _IF statement_ to create an easy-to-understand logic

An _If-Then-Else_ column using more than 4-5 combinations (with AND/OR mixtures) can drive anyone crazy 🥴

Saludos!

---

_[View the full topic](https://community.glideapps.com/t/filtering-data-with-and-and-or/78503)._
