# Help with Code please (Repeaters filter)

**URL:** <https://forum.wixstudio.com/t/help-with-code-please-repeaters-filter/23727>\
**Category:** Ask the community\
**Tags:** code, question\
**Created:** [March 22, 2018, 5:49pm UTC](https://forum.wixstudio.com/t/help-with-code-please-repeaters-filter/23727 "2018-03-22T17:49:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohabsaleh](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@mohabsaleh](https://forum.wixstudio.com/u/mohabsaleh)\
**Post date:** [March 22, 2018, 5:49pm UTC](https://forum.wixstudio.com/t/help-with-code-please-repeaters-filter/23727/1 "2018-03-22T17:49:52Z")

</div>

Good day to all,

Basically I have a dynamic page that is linked to two databases that previews supplements in a repeater. I am trying to add a dropdown filter with a clear button so that visitors can filter by brand of supplement. When a selection from the dropdown menu is chosen, the Title of page changes to that which the visitor has selected, and it obviously filters the repeater to show only selected Brand. I did not save this work as I am continuously publishing and still experimenting with this and so far it hasn’t worked.

This is the code I am using, I hope you can tell me what I am doing wrong:

//My clear button’s ID is clearButton and has an onClick event called clearButton\_click  
//My drop down’s ID is selection1 and has an onChange event called selection1\_change  
//My dynamic page title’s ID is text21.  
//I have two databases connected to the dynamic page:  
1)SupplementBrandCategory 2)Amino-BCAA  
//My dropdown list is connected to SupplementBrandCategory database, labels and values  
connected to Title  
//My repeater is connected to Amino-BCAA database  
//Inside database of Amino-BCAA i added a reference field that references the database SupplementBrandCategory. Its field value is called brandOfSupplement, and its field name is called brand of supplement  
//My repeater’s ID is repeater1

Still the code is not working !

```javascript
import wixData from 'wix-data';

$w.onReady(function () {

});
let selectedCategory = "";

export function selection1_change(event, $w) {
wixData.query("SupplementBrandCategory")
 .eq("title",$w("#selection1").value)
 .find()
 .then( (results) => {
  let firstItem = results.item[0];
  selectedCategory = firstItem._id;

  wixData.query("Amino-BCAA")
   .eq("brandOfSupplement",selectedCategory)
   .find()
   .then( (results) => {
    $w("#repeater1").data = results.items;
    $w("#text21").text = "POST WORKOUTS - " + $w("#selection1").value;
  } )
  .catch( (err) => {
    let errorMsg =err;
   } );
 });
}

export function clearButton_click(event, $w) {
  wixData.query("Amino-BCAA")
        .find()
        .then( (results) => {
         $w("#repeater1").data = results.items;
         $w("#text21").text = "POST WORKOUTS - ALL";
       } )
       .catch( (err) => {
         let errorMsg = err;
       } );
}

```

I will be extremely thankful to anyone who can tell me what I am doing wrong here!!! ☹ ☹

---

<div class="post-metadata">

**Author:** ![mohabsaleh](https://avatars.discourse-cdn.com/v4/letter/m/e95f7d/32.png) [@mohabsaleh](https://forum.wixstudio.com/u/mohabsaleh)\
**Post date:** [March 23, 2018, 3:01pm UTC](https://forum.wixstudio.com/t/help-with-code-please-repeaters-filter/23727/2 "2018-03-23T15:01:18Z")

</div>

Really hope someone can help with this !

---

<div class="post-metadata">

**Author:** ![tlukep](https://avatars.discourse-cdn.com/v4/letter/t/a88e4f/32.png) [@tlukep](https://forum.wixstudio.com/u/tlukep)\
**Post date:** [April 5, 2018, 2:55am UTC](https://forum.wixstudio.com/t/help-with-code-please-repeaters-filter/23727/3 "2018-04-05T02:55:07Z")

</div>

Hey Im having the same problem. My repeater is not filtering results from the dropdown I created. Were you able to find a solution for this? I noticed your code has some minor differences, here’s mine:

// For full API documentation, including code examples, visit [http://wix.to/94BuAAs](http://wix.to/94BuAAs)  
import wixData from ‘wix-Data’;

$w.onReady(function () {  
//TODO: write your page related code here…

});  
let selectedCategory = (“”);

export function dropdown1\_change(event, $w) {  
// Query from dropdown change event  
wixData.query(“Make”)  
.eq(“title”, $w(“#dropdown1”).value)  
.find()  
.then((results) =\> {  
let firstItem = results.items[0]; //First item in results  
selectedCategory = firstItem.\_id;

```
		wixData.query("CarDetails") 
			.eq("make", selectedCategory) 
			.find() 
			.then((results) => { 
				$w("#repeater1").data = results.items; 
			$w("#pageTitleText").text = "INVENTORY" + $w("#dropdown1").value; 
			}) 
			.catch((err) => { 
				let errorMsg = err; 
			}); 
	}); 

```

}

export function button13\_click(event, $w) {  
//Reload all items when clear button clicked  
wixData.query(“CarDetails”)  
.find()  
.then((results) =\> {  
$w(“#repeater1”).data = results.items;  
$w(“#pageTitleText”).text = “INVENTORY”;  
} )  
.catch((err) =\> {  
let errorMsg = err;  
} );  
}
