# Query Array or Joined List

**URL:** <https://community.glideapps.com/t/query-array-or-joined-list/42974>\
**Category:** Ask for Help\
**Created:** [June 11, 2022, 1:17pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974 "2022-06-11T13:17:48Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clint\_Nelms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/clint_nelms/32/38072_2.png) [@Clint\_Nelms](https://community.glideapps.com/u/Clint_Nelms)\
**Post date:** [June 11, 2022, 1:17pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/1 "2022-06-11T13:17:48Z")

</div>

hi  
in my app, I have array’s that have multiple text items in them, for example:  
Array:  
there is a cat  
there is a dog  
there is a bat

i want to query the array, or joined list and have it return a result, for example: “includes cat”  
would return  
“there is a cat”  
this seems super basic and maybe i am just not understanding how to do it in glide. i don’t want to involve user inteface filtering, i need it in line with glide tables (not google sheets).

can someone point me in the right direction?  
thank you!

---

<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:** [June 11, 2022, 1:44pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/2 "2022-06-11T13:44:59Z")

</div>

What would you expect if there were multiple matches?  
For example, if the query was `includes there`, what should the result be?

---

<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:** [June 11, 2022, 5:01pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/3 "2022-06-11T17:01:25Z")

</div>

Hola @Clint_Nelms

Do you need anything like this?

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

The tricky part should be this…

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/4/e44799529816f4a601d6d09fcad692ddf6e29006.png)

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

Saludos!

---

<div class="post-metadata">

**Author:** ![Clint\_Nelms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/clint_nelms/32/38072_2.png) [@Clint\_Nelms](https://community.glideapps.com/u/Clint_Nelms)\
**Post date:** [June 11, 2022, 5:22pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/4 "2022-06-11T17:22:38Z")

</div>

hi Darren,  
thank you for the fast response. I am actually in a good situation in that the array items/list items are all unique. so i don’t have to worry about duplicates or multiple matches…

---

<div class="post-metadata">

**Author:** ![Clint\_Nelms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/clint_nelms/32/38072_2.png) [@Clint\_Nelms](https://community.glideapps.com/u/Clint_Nelms)\
**Post date:** [June 11, 2022, 5:25pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/5 "2022-06-11T17:25:53Z")

</div>

hi  
thank you for the response. this is close to what i am after, however, i need to be able to seek a partial word. for example:  
array contents:  
this cat is red  
this cat is blue  
this cat is pink

the lookup should check for red, and the response needs to be “this cat is red”  
so i want to filter the array by the word red and respond with any array item that has the word red in it.

if that generates multiple responses, i.e. “the cat is red” and “the dog is red” that is perfectly fine…

---

<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:** [June 11, 2022, 6:13pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/6 "2022-06-11T18:13:25Z")

</div>

Ah, I see…

I think you are looking for an advanced filter method, take a look at this example and let me know your opinion: [Multi Filters using Relations: a new way 💡](https://community.glideapps.com/t/multi-filters-using-relations-a-new-way/36092)

Bye

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [June 11, 2022, 6:51pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/7 "2022-06-11T18:51:22Z")

</div>

Would it be okay if generated results like F **red** is blue?

---

<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:** [June 12, 2022, 1:04am UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/8 "2022-06-12T01:04:15Z")

</div>

I’m not sure there will be a simple way to do this using standard computed columns, but it’s easy enough with a bit of Javascript. The following should give the results that you describe:

```auto
var arr = p1.split(',');
var re = new RegExp(p2,'g');
var matches = [];
arr.forEach(function (item){
  if (item.match(re)) {
    matches.push(item); 
  }
});
return matches.join(',');

```

 ![Screen Shot 2022-06-12 at 9.03.02 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/e/2/e2099b437218a0bce4d3d7ea9158a50fe5681919.png)

 ![Screen Shot 2022-06-12 at 9.03.15 AM](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/f/6ffc9c118b68223f9bd7e665157b6ae1ad498c9b.png)

---

<div class="post-metadata">

**Author:** ![Clint\_Nelms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/clint_nelms/32/38072_2.png) [@Clint\_Nelms](https://community.glideapps.com/u/Clint_Nelms)\
**Post date:** [June 13, 2022, 6:13pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/9 "2022-06-13T18:13:44Z")

</div>

wonderful. thank you Darren. i will give it a try and report back.

---

<div class="post-metadata">

**Author:** ![Clint\_Nelms](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/clint_nelms/32/38072_2.png) [@Clint\_Nelms](https://community.glideapps.com/u/Clint_Nelms)\
**Post date:** [June 13, 2022, 6:47pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/10 "2022-06-13T18:47:13Z")

</div>

Darren, can’t thank you enough. that was awesome and worked perfectly.  
I subbed out the \* symbol in both the source joined list and the Java Script and I am getting the first match without issue. Should it be able to return more than one result? for example, if the Query was “this” can this approach respond with the “match multiple” style response and answer in a joined list?  
thank you!!!

---

<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:** [June 13, 2022, 9:23pm UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/11 "2022-06-13T21:23:31Z")

</div>

Ah, I understand better @Clint_Nelms

The plan B could be this (a no-code solution 😀)

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/6/b/6b7e6842836b20b816b3874a1403e47682693b84.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/1/5/15cf822140ae0f36a708cb5b7e4a0bdb1e4946d7.png)

Saludos!

---

<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:** [June 14, 2022, 1:00am UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/12 "2022-06-14T01:00:45Z")

</div>

> [@Clint\_Nelms](#):
>
> Darren, can’t thank you enough. that was awesome and worked perfectly.

Great, and you’re welcome 🙂

> [@Clint\_Nelms](#):
>
> I subbed out the \* symbol in both the source joined list and the Java Script

Not sure what you mean by this? That symbol isn’t used in the Javascript that I gave.

> [@Clint\_Nelms](#):
>
> Should it be able to return more than one result? for example, if the Query was “this” can this approach respond with the “match multiple” style response and answer in a joined list?

Yes.  
If you look closely at the example I gave, you’ll see that’s exactly what it does 😉

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [June 15, 2022, 1:00am UTC](https://community.glideapps.com/t/query-array-or-joined-list/42974/13 "2022-06-15T01:00:56Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
