# Table with multiple dataset filtering

**URL:** <https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465>\
**Category:** Ask the community\
**Tags:** wix-members-area, question, code\
**Created:** [October 23, 2018, 5:51pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465 "2018-10-23T17:51:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 23, 2018, 5:51pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/1 "2018-10-23T17:51:32Z")

</div>

I have 3 collections: Members, Tournaments, TxResults

TxResults contains a reference field named **Tournament** mapped to the **TxID** field that is in the Tournaments collection as well as a reference field called **Member** for the field **Member Name** in Members.

I have added a table to the page connected to the TxResults dataset, then created a dropdown connected to the Tournaments dataset to display a field called Location. Location is NOT a reference field in TxResults, but the TxID is.

What I would like to have happen is when the Location is selected (because it is more human-readable than the TxID) from the dropdown, the table is filtered to display TxResults for only that TxID.

Right now, the options in the dropdown is populating correctly, but when I select a Location, the table refreshes and there are no results.

This is what I have in my dropdown event:

export function Txdropdown\_change(event)  
{  
$w(“#Txdataset”).setFilter(wixData.filter().contains(“Tournament”, $w(“#Txdropdown”).value));  
}

Does anyone know if what I would like to do is possible?

I have tried following all of the Wix tutorials on YouTube regarding datasets and I also followed the one from Code Queen with using multiple dropdowns but that is not quite what I need.

---

<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:** [October 24, 2018, 12:16pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/2 "2018-10-24T12:16:05Z")

</div>

Make sure that you are using the field key and not the field name.

Not this: **Tournament**  
But this: **tournament**

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 24, 2018, 1:53pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/3 "2018-10-24T13:53:39Z")

</div>

Yisrael,

Thank you the reply. That is a very good point and I have corrected this, however it is still not working. Any other suggestions?

---

<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:** [October 24, 2018, 1:58pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/4 "2018-10-24T13:58:16Z")

</div>

What’s in the dropdown? If you are trying to filter based on the TxID, then each entry in the dropdown needs to have the value set to the correct TxID. You are doing a filter on the Tournament (key: tournament) field. Is that the same as TxID?

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 24, 2018, 2:40pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/5 "2018-10-24T14:40:17Z")

</div>

@yisrael-wix At first I was trying to use Location (not the same as TxID), but then switched to TxID and it is still not loading

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 25, 2018, 1:08am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/6 "2018-10-25T01:08:44Z")

</div>

@yisrael-wix The field **tournament** in TxResults collection is a reference field mapping to **txid** in Tournaments collection. Would that cause an issue if I was trying to filter on **tournament**?

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 25, 2018, 1:53am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/7 "2018-10-25T01:53:39Z")

</div>

So it looks like my data is disappearing from the table when using a referenced dataset filter. Following [CMS: About Displaying Content from Multiple Database Collections Using Reference Fields | Help Center | Wix.com](https://support.wix.com/en/article/wix-code-how-to-display-content-from-multiple-database-collections-using-reference-fields), I had a filter on my primary dataset for the TxResults collection for **Tournament** same as Tournaments dataset (connected to the Tournaments collection). Once I did that, no filters worked. Am I doing something wrong with this?

---

<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:** [October 28, 2018, 1:23pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/8 "2018-10-28T13:23:53Z")

</div>

@poolshark314 Please post the editor URL of your site so we can inspect. _Only authorized Wix personnel can get access to your site in the editor._

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 28, 2018, 4:02pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/9 "2018-10-28T16:02:09Z")

</div>

@yisrael-wix[https://editor.wix.com/html/editor/web/renderer/edit/3ec0c417-366f-4edc-bfeb-957a932a55c8?metaSiteId=308a04ab-a1b4-4720-aa59-9af494bab78b&editorSessionId=eda325c8-4ea0-4413-938a-5cb9c47b164a&referralInfo=my-account](https://editor.wix.com/html/editor/web/renderer/edit/3ec0c417-366f-4edc-bfeb-957a932a55c8?metaSiteId=308a04ab-a1b4-4720-aa59-9af494bab78b&editorSessionId=eda325c8-4ea0-4413-938a-5cb9c47b164a&referralInfo=my-account)

Thanks. It’s the static page labeled RESULTS

---

<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:** [October 29, 2018, 9:16am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/10 "2018-10-29T09:16:40Z")

</div>

@poolshark314 You have the BoaterTxdataset dataset filtered like this:

![](https://us1.discourse-cdn.com/wix/original/3X/d/6/d6d87b42cdd9942a8af4260b0bc233812b24363b.png)  
This is perfect. Since one of the filters is **Tournament same as current item from Tournaments dataset** , all you need to do is to filter the Tournaments dataset ( **Txdataset** ) like this:

```javascript
let txvalue = $w('#Txdropdown').value;
$w('#Txdataset').setFilter(wixData.filter().eq("title", txvalue));

```

Get rid of the other filters as the filtering is done using the Txdataset.

I tried this and it seems to work for me.

Good luck,

Yisrael

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [October 29, 2018, 5:39pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/11 "2018-10-29T17:39:48Z")

</div>

@yisrael-wix Yes that worked! But I did notice there is a different problem. After the dropdown is selected and the tables refresh, the dropdown is then locked to your selection. When you click the dropdown, no other options populate. Any thoughts on why this is happening? Thank you very much for your help!

![](https://us1.discourse-cdn.com/wix/original/3X/a/d/ada0f993ebaa9f31cc6a53e1145e01f30771841d.png)

---

<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:** [October 31, 2018, 7:56am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/12 "2018-10-31T07:56:31Z")

</div>

@poolshark314 The problem is that after setting a filter on the Txdataset it will only have the filtered item - and that’s what’s being used to populate the dropdown.

To solve your problem, you need two datasets connected to the Tournaments dataset (Txdataset). One that is not filtered and is used to populate the dropdown, and the existing dataset that is filtered by the dropdown value, which is then used to filter the results.

---

<div class="post-metadata">

**Author:** ![poolshark314](https://avatars.discourse-cdn.com/v4/letter/p/3bc359/32.png) [@poolshark314](https://forum.wixstudio.com/u/poolshark314)\
**Post date:** [November 1, 2018, 12:44am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/13 "2018-11-01T00:44:53Z")

</div>

@yisrael-wix Than you, that worked great!

---

<div class="post-metadata">

**Author:** ![cakandari](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/cakandari/32/17780_2.png) [@cakandari](https://forum.wixstudio.com/u/cakandari)\
**Post date:** [March 22, 2020, 10:38am UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/14 "2020-03-22T10:38:56Z")

</div>

how we can set multiple filters on single export function input\_change(event)

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [March 22, 2020, 2:27pm UTC](https://forum.wixstudio.com/t/table-with-multiple-dataset-filtering/465/15 "2020-03-22T14:27:41Z")

</div>

Please post a new forum post and refer back to this with a link instead of bumping up an old thread from 2018.

Closed.
