# Filtering for referenced fields in tables

**URL:** https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397
**Category:** How do I?
**Created:** [July 6, 2023, 1:02am UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397 "2023-07-06T01:02:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sleeusis](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sleeusis](https://community.weweb.io/u/sleeusis)
#### Post date: [July 6, 2023, 1:02am UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397/1 "2023-07-06T01:02:31Z")

</div>

Hi, can referenced fields like **newfieldname: table (nameofthefield)** be referenced as text to be used in filters for condition such as “contain”. It seems that the referenced field is returned as an object even when is a text and the only options are ‘Is exactly’, ‘Is Empty’ and ‘Is not Empty’.

Any thought?

Thank you

---

<div class="post-metadata">

### Author: ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)
#### Post date: [July 6, 2023, 8:48am UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397/2 "2023-07-06T08:48:01Z")

</div>

Hi @sleeusis 👋

You should be able to yes. Here’s what a filter at collection level could look like for example:

 ![CleanShot 2023-07-06 at 10.45.26@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/d338f53caf8ccb560cb6c268c2fe443da1b58b79.png)

You have the same filters at page level:

 ![CleanShot 2023-07-06 at 10.46.45@2x](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/13d6e04f8eff930087c51d70aea608065126d931.png)

Can you share a bit more information about your project?

Maybe a couple of screenshots to help us see what the data you’re trying to filter looks like and where you’re trying to filter it (at collection level, on a page, using the filter dropdown or a filterByKey formula for example)

---

<div class="post-metadata">

### Author: ![sleeusis](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sleeusis](https://community.weweb.io/u/sleeusis)
#### Post date: [July 6, 2023, 1:13pm UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397/4 "2023-07-06T13:13:33Z")

</div>

Hi @Joyce - I’m using supabase and for the collection I have a table called _events_ with a reference field to a record in a table called _sites_. As on the screenshot below, I have a _Site\_Address:Site (Address)_ and I want to be able to filter for a condition containing a substring of the address but it seems the referenced values from the fields are returned as objects _{}_ and the option is not there in the filter.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b0b77226d69528e4916508dbb9557a3f569fa1d5.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/e74b2f4754e531c6c2c6fc3ac50276db189d2571.png)  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/d2e2cc68e5a04370bc16e6273557059ee2751b36.png)

Thank you

---

<div class="post-metadata">

### Author: ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)
#### Post date: [July 6, 2023, 4:36pm UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397/5 "2023-07-06T16:36:40Z")

</div>

Ah ok got it!

So yeah, when you use the Advanced mode, Supabase returns an object which we indeed cannot filter on in depth at the moment. It’s a limitation of the plugin we’re aware of but not quite sure how to improve yet.

For now you have 2 solutions:

1. create a view in Supabase where the address is a field, then fetch that view in WeWeb, and filter on that collection, or

2. create 2 collections in WeWeb: one for your events table and one for your site table. Then, you can filter your events collection based on the id of the address in the site collection. Here’s a [short video](https://tella.video/supabase-filtering-ref-fields-c5kv) on how you would do this.

Does that help?

---

<div class="post-metadata">

### Author: ![sleeusis](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sleeusis](https://community.weweb.io/u/sleeusis)
#### Post date: [July 6, 2023, 5:18pm UTC](https://community.weweb.io/t/filtering-for-referenced-fields-in-tables/3397/6 "2023-07-06T17:18:20Z")

</div>

@Joyce - Yeah, I created a view in supabase before to circumvent this but I lost the realtime capability. I will try with your second suggestion. As always, thank you!
