# Filter for something included in an array

**URL:** <https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945>\
**Category:** Ask for Help\
**Created:** [April 23, 2021, 1:45pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945 "2021-04-23T13:45:18Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 23, 2021, 1:45pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/1 "2021-04-23T13:45:18Z")

</div>

Hi everyone,  
I’m trying to figure out how to do something a little bit tricky here.

So, I have a user table with a column where a formula return all the accessible Zones delimited by a `,`  
 ![Capture d’écran 2021-04-23 à 15.36.48](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/c/ac70497f246cd0c6fb1e6216e27b0b01ac7bf36c.png)

Then in my data editor, I do a split by `,` and then a relation with the zones names to get them all  
 ![Capture d’écran 2021-04-23 à 15.40.54](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/a/9/a95a1b8eaa8512674ea34d3fec3a0ea3d9ce98dd.png)

Now I have a list of zones (which have multiple entries) and I would like to just display for the current user the zones that are in his Accessible Zone relations list. But _is included in_ doesn’t support array or relations. Any idea?

> **Why on earth am I doing this?**
>
> I’m doing all of this because we can’t combine AND and OR in a view filter. I would like to do `Agency = user.agency AND active = true and [restrictedTo is empty OR restrictedTo includes user.businessUnit]`. So I did a formula using `FILTER` and a `JOIN` to create a comma-separated list of the zones a user can have access

---

<div class="post-metadata">

**Author:** ![Jacktools\_Net](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jacktools_net/32/18500_2.png) [@Jacktools\_Net](https://community.glideapps.com/u/Jacktools_Net)\
**Post date:** [April 23, 2021, 3:17pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/2 "2021-04-23T15:17:41Z")

</div>

Create a joined list column based on your relation and use “is included” on this joined list.

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 23, 2021, 3:18pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/3 "2021-04-23T15:18:25Z")

</div>

Already have the join list (which I create in Google Sheet) but seems not working ☹

---

<div class="post-metadata">

**Author:** ![Jacktools\_Net](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jacktools_net/32/18500_2.png) [@Jacktools\_Net](https://community.glideapps.com/u/Jacktools_Net)\
**Post date:** [April 23, 2021, 3:34pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/4 "2021-04-23T15:34:30Z")

</div>

try to created it in glide.

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 23, 2021, 3:59pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/5 "2021-04-23T15:59:34Z")

</div>

Well I use this formula to create the join list.

```auto
=JOIN(",",FILTER(Zones!$C$2:$C,Zones!$A$2:$A=$F2,Zones!$D$2:$D=TRUE,Zones!$H$2:$H=""),IFNA(FILTER(Zones!$C$2:$C,Zones!$A$2:$A=$F2,Zones!$D$2:$D=TRUE,SEARCH($G2,Zones!$H$2:$H))))

```

I don’t think I can do the same in Glide. Ok I can do the join but then I’ll need two column where I have my two FILTER formulas which add more unnecessary columns ☹

---

<div class="post-metadata">

**Author:** ![Jacktools\_Net](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jacktools_net/32/18500_2.png) [@Jacktools\_Net](https://community.glideapps.com/u/Jacktools_Net)\
**Post date:** [April 23, 2021, 4:16pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/6 "2021-04-23T16:16:37Z")

</div>

Right, but you can use your “Accessible Zones” Relation to create a Joined List Column in Glide. And I think on this joined list column you can filter with “is included” or “includes”

---

<div class="post-metadata">

**Author:** ![11183](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/11183/32/29797_2.png) [@11183](https://community.glideapps.com/u/11183)\
**Post date:** [April 23, 2021, 7:10pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/7 "2021-04-23T19:10:36Z")

</div>

@Thibault_Milan try not to use filtering, but use relation column as a SOURCE for Inline list.

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 23, 2021, 9:40pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/8 "2021-04-23T21:40:53Z")

</div>

Hey 😃 Thanks for you reply and welcome here 😁 you first post 🎉.

Well unfortunately I NEED to filter the data (that’s what I’m trying to achieve here, read the “Why on earth am I doing this” to get more context. Relation can’t be filtered when you are building a column or use them as source source for inline list.

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [April 23, 2021, 11:44pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/9 "2021-04-23T23:44:30Z")

</div>

In your first screenshot, is that Accessible Zones tied to an email of the user?

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 30, 2021, 7:38am UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/10 "2021-04-30T07:38:26Z")

</div>

Accessible Zones is based on the `business unit` of the employee.  
Zones can be accessible to all (no restriction) or accessible to one or more business units.

So in the Zones I have a `Restricted to` field which is a comma-separated value :

 ![Capture d’écran 2021-04-30 à 09.30.00](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/3/9/3922d68b8aa918e3c77dd883d1a23fb657672bfc.png)  
Then in the data editor I’m splitting them because I wanted to be able to display the zone’s list filtered by the user’s business unit but … seems it can’t be done on an array (the result of the split).  
 ![Capture d’écran 2021-04-30 à 09.33.38](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/4/2/42b9fe0a0c7efe236f67880fb67ae33b74987a83.png)

So I went the other way around. Creating a Google Sheet formula that list in the user’s row all the zones he have access to, hoping to be able to filter by it when displaying the zone’s list, but same issue ☹

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 30, 2021, 7:49am UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/11 "2021-04-30T07:49:53Z")

</div>

> [@Thibault\_Milan](#):
>
> I’m doing all of this because we can’t combine AND and OR in a view filter. I would like to do `Agency = user.agency AND active = true and [restrictedTo is empty OR restrictedTo includes user.businessUnit]` . So I did a formula using `FILTER` and a `JOIN` to create a comma-separated list of the zones a user can have access

There is no need to resort to GSheet formulas for this, it should be perfectly achievable by using if-then-else columns to construct two template columns, and then build a relation using the resultant template columns. Using this technique, you shouldn’t even need a filter on the Inline List.

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 30, 2021, 1:11pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/12 "2021-04-30T13:11:16Z")

</div>

My understanding is a if-then-else column can’t use complex situations so I cannot build something like A and B and [C or D] 😕 But I would love to understand how I could achieve this.

I could probably to IF c THEN true ELSEIF d THEN TRUE ELSE FALSE → _intermediary column_  
but I still can’t have a A AND B AND _intermediary column_

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [April 30, 2021, 1:14pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/13 "2021-04-30T13:14:19Z")

</div>

For something like that, you would have to structure it like the following

IF not A Then False  
ElseIF not B Then False  
ElseIF C Then True  
ElseIF D Then True  
Else False

---

<div class="post-metadata">

**Author:** ![Manu.n](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/manu.n/32/11679_2.png) [@Manu.n](https://community.glideapps.com/u/Manu.n)\
**Post date:** [April 30, 2021, 1:14pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/14 "2021-04-30T13:14:43Z")

</div>

# Hello @Thibault_Milan If it’s boolean (0/1) values ​​you can use a math formula example A and B and [C or D]

A \* B \* (C + D)

---

<div class="post-metadata">

**Author:** ![Thibault\_Milan](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thibault_milan/32/4970_2.png) [@Thibault\_Milan](https://community.glideapps.com/u/Thibault_Milan)\
**Post date:** [April 30, 2021, 2:02pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/15 "2021-04-30T14:02:16Z")

</div>

Though about that but it’s not boolean values (unfortunalty :p)

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [April 30, 2021, 3:29pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/16 "2021-04-30T15:29:43Z")

</div>

> [@Thibault\_Milan](#):
>
> My understanding is a if-then-else column can’t use complex situations so I cannot build something like A and B and [C or D] 😕 But I would love to understand how I could achieve this.
> 
> I could probably to IF c THEN true ELSEIF d THEN TRUE ELSE FALSE → _intermediary column_  
> but I still can’t have a A AND B AND _intermediary column_

If you can share a GSheet with some sample data, I’ll take a look at it for you.

---

<div class="post-metadata">

**Author:** ![Nugget\_Kelly](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/nugget_kelly/32/18704_2.png) [@Nugget\_Kelly](https://community.glideapps.com/u/Nugget_Kelly)\
**Post date:** [August 26, 2021, 12:55pm UTC](https://community.glideapps.com/t/filter-for-something-included-in-an-array/25945/17 "2021-08-26T12:55:59Z")

</div>

Thank you for this comment!!!
