Help on connecting repeater to a filtered dropdown via dataset

Hi all, would really appreciate some help connecting my dropdown functions to a repeater.
I’ve used code to allow three dropdowns that filter down based on selection. This is all connected up and works great.

My struggle telling those dropdowns to display the relevant content in my repeater once all three dropdowns.

I’ve half managed to get it working and on some dropdown selections it displays the correct content, then on others it either displays multiples of the correct content or just pulls blank. My code knowledge isn’t good enough to figure out where I’m going wrong. PLEASE HELP!

The current page is here >> https://www.review.dupreefs.com/newbuilds-book
And please see the code i’ve used below:


import wixData from 'wix-data';
 
 
$w.onReady(function () {
    uniqueDropDown1();
});

function uniqueDropDown1 (){
    wixData.query("Dupree_NewBuild_Booking")
        .limit(1000)
      .find()
      .then(results => {
 const uniqueTitles = getUniqueTitles(results.items);
           $w("#sitedropdown").options = buildOptions(uniqueTitles);
      });
 function getUniqueTitles(items) {
 const titlesOnly = items.map(item => item.site);
 return [...new Set(titlesOnly)];
    }
 function buildOptions(uniqueList) {
 return uniqueList.map(curr => {
 return {label:curr, value:curr};
        });
    }
}
 
export function sitedropdown_change(event, $w) {
uniqueDropDown2();
$w("#locationdropdown").enable();
}
 
function uniqueDropDown2 (){
    wixData.query("Dupree_NewBuild_Booking")
        .contains("site", $w("#sitedropdown").value)
        .limit(1000)
      .find()
      .then(results => {
 const uniqueTitles = getUniqueTitles(results.items);
           $w("#locationdropdown").options = buildOptions(uniqueTitles);
      });
 function getUniqueTitles(items) {
 const titlesOnly = items.map(item => item.location);
 return [...new Set(titlesOnly)];
    }
 function buildOptions(uniqueList) {
 return uniqueList.map(curr => {
 return {label:curr, value:curr};
        });
    }
}
 
export function locationdropdown_change(event, $w) {
uniqueDropDown3();
$w("#advisordropdown").enable();
}
 
function uniqueDropDown3 (){
    wixData.query("Dupree_NewBuild_Booking")
        .contains("location", $w("#locationdropdown").value)
        .limit(1000)
      .find()
      .then(results => {
 const uniqueTitles = getUniqueTitles(results.items);
           $w("#advisordropdown").options = buildOptions(uniqueTitles);
      });
 function getUniqueTitles(items) {
 const titlesOnly = items.map(item => item.advisor);
 return [...new Set(titlesOnly)];
    }
 function buildOptions(uniqueList) {
 return uniqueList.map(curr => {
 return {label:curr, value:curr};
        });
    }
}

$w.onReady(function () { 

$w("#Button").onClick(()=>{ $w("#newbuilddataset").setFilter(wixData.filter() 
.eq("site", $w("#sitedropdown").value) 
.eq("location", $w("#locationdropdown").value)
.eq("advisor", $w("#advisordropdown").value));
        });     
    });

Well first thing!
Never use more then just ONE —> onReady() in your code.

Second, here you can see an upgraded version of your —> Get unique titles-function…

Instead of coding it for every single dropdown, you can use my shown code for all your dropdowns. I hope you will understand how to implement and use this CODE-SNIPET.

import wixData from 'wix-data';

var DATABASE = "your Collection-Name here"
var DropDowns=[]
var DDprefix "DD"                   ; //ID-prefix of all your dopdowns (DD1, DD2..)
//----------------------------------|
DropDowns[0] = "reference-column1"  ;  //column in your DATABASE ("title")
DropDowns[1] = "reference-column2"  ;  //column in your DATABASE 
DropDowns[2] = "reference-column3"  ;  //column in your DATABASE 
DropDowns[3] = "reference-column4"  ;  //column in your DATABASE 
DropDowns[4] = "reference-column5"  ;  //column in your DATABASE 
DropDowns[5] = "reference-column6"  ;  //column in your DATABASE 
DropDowns[6] = "reference-column7"  ;  //column in your DATABASE      
DropDowns[7] = "reference-column8"  ;  //column in your DATABASE    
DropDowns[8] = "reference-column9"  ;  //column in your DATABASE    
DropDowns[9] = "reference-column10" ;  //column in your DATABASE 
//----------------------------------|
async function uniqueTitles_DropDowns() {
 console.log("load_UniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="undefined" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]
            })
        }       
    }   
}
$w.onReady(function () { 

$w("#Button").onClick(()=>{ $w("#newbuilddataset").setFilter(wixData.filter() 
.eq("site", $w("#sitedropdown").value) 
.eq("location", $w("#locationdropdown").value)
.eq("advisor", $w("#advisordropdown").value));
        });     
    });

+++++++++++++++ (combination)

$w.onReady(function () {
    uniqueDropDown1();
});

=============== (result)

$w.onReady(function () { 
   uniqueDropDown1();
   $w("#Button").onClick(()=>{ 
      $w("#newbuilddataset").setFilter(wixData.filter() 
      .eq("site", $w("#sitedropdown").value) 
      .eq("location", $w("#locationdropdown").value)
      .eq("advisor", $w("#advisordropdown").value));
   });     
});

Your CODE could look like this…

import wixData from 'wix-data';

//------------[User-Interface-----------------------------------------------------|
var DATABASE = "your Collection-Name here"
var DropDowns=[]
var DDprefix "DD"                   ; //ID-prefix of all your dopdowns (DD1, DD2..)
//----------------------------------|
DropDowns[0] = "reference-column1"  ;  //column in your DATABASE ("title")
DropDowns[1] = "reference-column2"  ;  //column in your DATABASE 
DropDowns[2] = "reference-column3"  ;  //column in your DATABASE 
DropDowns[3] = "reference-column4"  ;  //column in your DATABASE 
DropDowns[4] = "reference-column5"  ;  //column in your DATABASE 
DropDowns[5] = "reference-column6"  ;  //column in your DATABASE 
DropDowns[6] = "reference-column7"  ;  //column in your DATABASE      
DropDowns[7] = "reference-column8"  ;  //column in your DATABASE    
DropDowns[8] = "reference-column9"  ;  //column in your DATABASE    
DropDowns[9] = "reference-column10" ;  //column in your DATABASE 
//------------[User-Interface-----------------------------------------------------|

//------------starting CODE-part when page loads.....
$w.onReady(function () { 
   load_uniqueTitles_DropDowns();
   $w("#Button").onClick(()=>{ 
      $w("#newbuilddataset").setFilter(wixData.filter() 
      .eq("site", $w("#sitedropdown").value) 
      .eq("location", $w("#locationdropdown").value)
      .eq("advisor", $w("#advisordropdown").value));
   });  
   
   $w('#sitedropdown').onChange(()=>{
      $w("#locationdropdown").enable();
   })   
   
   $w('#locationdropdown').onChange(()=>{
      $w("#advisordropdown").enable();
   }) 
});

//-----loading of DropDown-Unique-Titles for all given DropDowns.....
async function load_uniqueTitles_DropDowns() {
 console.log("Load uniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="undefined" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]
            })
        }       
    }   
}


Follow these post, to understand more…
https://www.wix.com/velo/forum/community-discussion/wix-storage-checkboxgroup/p-1/dl-5fcc17364ce20b002d0ffbdf-5fcc15f3a032ca0034d80c97-1

And take a look onto this example here…
https://www.media-junkie.com/pflegeservice
…where you will find the shown working CODE above and a lot more usefull informations.

You will have first to filter and then send the filtered DATA to your repeater.

if ($w('#switch2').checked) {console.log("AND-Filter activated")
   let query = wixData.query(DATABASE).limit(1000)
 
   //Filter-DropDowns-------------------------------------------
   for (let i=0; i < DropDowns.length; i++) {
       
      if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
         $w('#'+DDpräfix+(i+1)).value = MEMdropdowns[i]
         query =  query.eq(DropDowns[i], MEMdropdowns[i])
      }
   }
 
   query.find()
   .then(async res => {
       itemDATA = await res.items          
       console.log(itemDATA)
   })
}

Complete-Code…

import wixData from 'wix-data';

//------------[User-Interface-----------------------------------------------------|
var DATABASE = "your Collection-Name here"
var REPEATER = "ID of your repeater here"
var DropDowns= []
var MEMdropdowns = []
var DDprefix = "dropdown"           ; //ID-prefix of all your dopdowns (DD1, DD2..)
//----------------------------------|
DropDowns[0] = "reference-column1"  ;  //column in your DATABASE ("title")
DropDowns[1] = "reference-column2"  ;  //column in your DATABASE 
DropDowns[2] = "reference-column3"  ;  //column in your DATABASE 
DropDowns[3] = "reference-column4"  ;  //column in your DATABASE 
DropDowns[4] = "reference-column5"  ;  //column in your DATABASE 
DropDowns[5] = "reference-column6"  ;  //column in your DATABASE 
DropDowns[6] = "reference-column7"  ;  //column in your DATABASE      
DropDowns[7] = "reference-column8"  ;  //column in your DATABASE    
DropDowns[8] = "reference-column9"  ;  //column in your DATABASE    
DropDowns[9] = "reference-column10" ;  //column in your DATABASE 
//------------[User-Interface-----------------------------------------------------|

//------------starting CODE-part when page loads.....
$w.onReady(function () { 
   load_uniqueTitles_DropDowns();
   //$w("#Button").onClick(()=>{ 
   //   $w("#newbuilddataset").setFilter(wixData.filter() 
   //   .eq("site", $w("#sitedropdown").value) 
   //   .eq("location", $w("#locationdropdown").value)
   //   .eq("advisor", $w("#advisordropdown").value));
   //});  
   
   $w('#sitedropdown').onChange(()=>{
      MEMdropdowns[0] = $w('#sitedropdown').value
      $w('#sitedropdown').enable();
      FILTER_ENGINE()
   })   
   
   $w('#locationdropdown').onChange(()=>{
      MEMdropdowns[1] = $w('#locationdropdown').value
      $w('#locationdropdown').enable();
      FILTER_ENGINE()
   }) 
   
   $w('#advisordropdown').onChange(()=>{
      MEMdropdowns[2] = $w('#advisordropdown').value
      $w('#advisordropdown').enable();
      FILTER_ENGINE()
   }) 
});

//-----loading of DropDown-Unique-Titles for all given DropDowns.....
async function load_uniqueTitles_DropDowns() {
 console.log("Load uniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="undefined" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]
            })
        }       
    }   
}

function FILTER_ENGINE() {
   if ($w('#switch2').checked) {console.log("Filter activated")
      let query = wixData.query(DATABASE).limit(1000)
 
      //Filter-DropDowns-------------------------------------------
      for (let i=0; i < DropDowns.length; i++) {
       
         if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#'+DDpräfix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
         }
      }
      query.find()
      .then(async res => {
          let itemData = await res.items          
          console.log(itemData)
          $w('#'+REPEATER).data = itemData
      })
   }
}

Hi @russian-dima , thank you so much for taking the time to reply. I’ve had a good read through of everything you’ve sent and the links you shared and I am just not getting it. Really struggling to get my head around it.

The first thing I couldnt figure out is the " MEMdropdowns" - it said it was undefined and I can’t see where to define it/make it work. arrrrrghhh

I’ve listed my tags and fields below, if there is anyway you could help to show me where they should slot into the code you gave me above, I’d be REALLY grateful!


Collection: “Dupree_staff”

Dataset ID: #newbuilddataset

Repeater: #repeater2

DROPDOWNS:

Dropdown 1: #sitedropdown

Dropdown 2: #locationdropdown

Dropdown 3: #advisordropdown

Search Button: #Button

SITE FIELDS:

Site field key: “site”

Location field key: “location”

Advisor field key: “advisor”

Show me a part of your DATABASE (first 2 lines are enough [Title+first row]) and i show you how it could work for you.

Of course! Does this help?

Here for you a little example…


Do this setup in the settings of this FILTER here…
https://www.media-junkie.com/pflegeservice


Then choose the preset, which you have setted up.


You will see how the given CODE above is working…:wink:

Use and test the filter, have fun :grin:

P.S.: I have updated my CODE!

@russian-dima Hello! Really appreciate your help! Again, i’ve looked through the code and tried to figure it out through the link you gave me but i’m such a novice, i’m struggling :frowning:

I’ve pasted below where i’m currently at with the code. Please help if you can.

After your instruction of " //-----loading of DropDown-Unique-Titles for all given DropDowns…" I have no idea if I have inputted the data correctly from there on down.

And then this bit >>
function FILTER_ENGINE() {
if ($w( ‘#switch2’ ).checked) {console.log( “Filter activated” )
let query = wixData.query(DATABASE).limit( 1000 )

is this related to a check box? Because I don’t have one of those.

It’s also saying “query is not defined”.

Thank you!


import wixData from 'wix-data';

//------------[User-Interface-----------------------------------------------------|
var DATABASE = "#newbuilddataset"
var REPEATER = "#repeater2"
var DropDowns= []
var MEMdropdowns = []
var DDprefix = "#sitedropdown, #locationdropdown, #advisordropdown"; //ID-prefix of all your dopdowns (DD1, DD2..)
//----------------------------------|
DropDowns[0] = "site"  ;  //column in your DATABASE ("title")
DropDowns[1] = "location"  ;  //column in your DATABASE 
DropDowns[2] = "advisor"  ;  //column in your DATABASE 
 
//------------[User-Interface-----------------------------------------------------|

//------------starting CODE-part when page loads.....
$w.onReady(function () { 
   load_uniqueTitles_DropDowns();
 //$w("#Button").onClick(()=>{ 
 //   $w("#newbuilddataset").setFilter(wixData.filter() 
 //   .eq("site", $w("#sitedropdown").value) 
 //   .eq("location", $w("#locationdropdown").value)
 //   .eq("advisor", $w("#advisordropdown").value));
 //});  
 
   $w('#sitedropdown').onChange(()=>{
      MEMdropdowns[0] = $w('#sitedropdown').value
      $w('#sitedropdown').enable();
      FILTER_ENGINE()
   })   
 
   $w('#locationdropdown').onChange(()=>{
      MEMdropdowns[1] = $w('#locationdropdown').value
      $w('#locationdropdown').enable();
      FILTER_ENGINE()
   }) 
 
   $w('#advisordropdown').onChange(()=>{
      MEMdropdowns[2] = $w('#advisordropdown').value
      $w('#advisordropdown').enable();
      FILTER_ENGINE()
   }) 
});

//-----loading of DropDown-Unique-Titles for all given DropDowns.....
async function load_uniqueTitles_DropDowns() {
 console.log("Load uniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="site" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"location": items[b], "#locationdropdown": items[b]})
                }
                $w('#sitedropdown'+DDprefix+(a+1)).options = Options[a]
                $w('#locationdropdown'+DDprefix+(a+1)).placeholder = DropDowns[a]
            })
        }       
    }   
}
 
 function FILTER_ENGINE() {
 if ($w('#switch2').checked) {console.log("Filter activated")
 let query = wixData.query(DATABASE).limit(1000)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#'+DDpräfix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
         }
      }
      query.find()
      .then(async res => {
 let itemData = await res.items          
          console.log(itemData)
          $w('#'+REPEATER).data = itemData
      })
   }
}


  1. yes you are right, i forgot to cut this code-part out…

    if ( $w ( ‘#switch2’ ). checked ) { console . log ( “Filter activated” )

You can delete this if-statement, it is not needed for you. Attention with closing-curly-braket!

  1. Did you try the given example?

  2. query-problem → did you define–> DATABASE in User-Interface?

I tried your example but the page is in german and I don’t understand :frowning:

This is what I’ve defined in my user-interface:

import wixData from 'wix-data';

//------------[User-Interface-----------------------------------------------------|
var DATABASE = "#newbuilddataset"
var REPEATER = "#repeater2"
var DropDowns= []
var MEMdropdowns = []
var DDprefix = "#sitedropdown, #locationdropdown, #advisordropdown";
//----------------------------------|
DropDowns[0] = "site"  ; 
DropDowns[1] = "location"  ;  
DropDowns[2] = "advisor"  ;

Is this correct? Do I need to add something next to the below:

var DropDowns =

var MEMdropdowns =

var DDprefix = "#sitedropdown, #locationdropdown, #advisordropdown";

No, DDprefix is the prefix-ID of all your dropdowns…

EXAMPLE: If you have for example 3x dropdowns called “DD1”, “DD2”, “DD3”, than your DDprefix would be —> “DD”.

If your 3x dropdowns would have the following IDs → “dropdown1”, “dropdown2”, “dropdown3”, than the DDprefix would be —> dropdown.

In simple words → prefix + index (dropdown-index) = dropdown-ID.

You will have to rename your dropdowns to one prefix ---->

dd1, dd2, dd3 or dropdown1, dropdown2, dropdown3, all IDs should have the same PREFIX

Or to generate an ARRAY ---->

myDropdowns = ["#sitedropdown, #locationdropdown,  #advisordropdown"]

No! No dataset. This example uses DATABASE (COLLECTION), no DATASET!

var DATABASE = "#newbuilddataset"

RIGHT!

var DATABASE = "Collection-Name" ----> "Dupree_stuff"

OK!

var REPEATER = "#repeater2"
var DropDowns= []
var MEMdropdowns = []

OK!

DropDowns[0] = "site"  ; 
DropDowns[1] = "location"  ;  
DropDowns[2] = "advisor"  ;

-----------------------------------CODE-UPDATE-II-------------------------------------------

import wixData from 'wix-data';


//------------[User-Interface-----------------------------------------------------|
var DATABASE = "Dupree_stuff"
var REPEATER = "#repeater2"
var DDprefix = "dropdown" //rename related dropdowns, like shown DDprefix -> dropdown)
//----------------------------------|
DropDowns[0] = "site"  ;        //column in your DATABASE ("title")
DropDowns[1] = "location"  ;    //column in your DATABASE 
DropDowns[2] = "advisor"  ;     //column in your DATABASE 
//------------[User-Interface-----------------------------------------------------|

var DropDowns= []
var MEMdropdowns = []

//------------starting CODE-part when page loads.....
$w.onReady(function () { 
   load_uniqueTitles_DropDowns();
  
   $w('#sitedropdown').onChange(()=>{console.log("Site-DropDown clicked")
      MEMdropdowns[0] = $w('#sitedropdown').value
      $w('#sitedropdown').enable();
      FILTER_ENGINE()
   })   
 
   $w('#locationdropdown').onChange(()=>{console.log("Location-DropDown clicked")
      MEMdropdowns[1] = $w('#locationdropdown').value
      $w('#locationdropdown').enable();
      FILTER_ENGINE()
   }) 
 
   $w('#advisordropdown').onChange(()=>{console.log("Advisor-DropDown clicked")
      MEMdropdowns[2] = $w('#advisordropdown').value
      $w('#advisordropdown').enable();
      FILTER_ENGINE()
   }) 
});

//-----loading of DropDown-Unique-Titles for all given DropDowns.....
async function load_uniqueTitles_DropDowns() {
 console.log("Load uniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="site" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]    
            })
        }       
    }   
}
 
 function FILTER_ENGINE(){
 let query = wixData.query(DATABASE).limit(1000)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#'+DDpräfix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
        }
    }
    query.find()
    .then(async res => {
 let itemData = await res.items          
        console.log(itemData)
        $w('#'+REPEATER).data = itemData
    })
}

Here your example…

And here your DB-PRESET (main)…


https://www.media-junkie.com/pflegeservice

Thank you, slowly starting to make sense. I keep looking at the link you’ve shared and have found the screenshots you show, but it isn’t helping me to understand the code.

So on the user interface, my dropdown labels are sitedropdown, locationdropdown, advisordropdown, so is my DDprefix “dropdown” as you posted below?

var DATABASE = "Dupree_stuff"
var REPEATER = "#repeater2"
var DDprefix = "dropdown" //rename related dropdowns, like shown DDprefix -> dropdown)

I am still stuck on the below and what ids/fields should go in in place of the purple text:

for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]    
            })
        }       
    }   
}
 
 function FILTER_ENGINE(){
 let query = wixData.query(DATABASE).limit(1000)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#dropdown'+DDprefix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
        }
    }
    query.find()
    .then(async res => {
 let itemData = await res.items          
        console.log(itemData)
        $w('#'+REPEATER).data = itemData
    })
}

You do not have to change anything within the FILTER-ENGINE-FUNCTION.
Do not touch the CODE itself. Just modify the “User-Interface-Values”.

Wrong-way…

function FILTER_ENGINE(){
 let query = wixData.query(DATABASE).limit(1000)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#dropdown'+DDprefix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
        }
    }
    query.find()
    .then(async res => {
 let itemData = await res.items          
        console.log(itemData)
        $w('#'+REPEATER).data = itemData
    })
}

Right way…

function FILTER_ENGINE(){
 let query = wixData.query(DATABASE).limit(1000)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#'+DDprefix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
        }
    }
    query.find()
    .then(async res => {
 let itemData = await res.items          
        console.log(itemData)
        $w('#'+REPEATER).data = itemData
    })
}

Ok, one more time all CODE-PARTS together…

import wixData from 'wix-data';

//------------[VARIABLES]---------------------|
var DropDowns= []            //-----> do not touch or change this :-) !
var MEMdropdowns = []        //-----> do not touch or change this :-) !
//------------[VARIABLES]---------------------|


//------------[User-Interface-----------------------------------------------------|
var DATABASE = "Dupree_stuff" //-----> here the NAME of your DATABASE (NOT DATASET!)!
var databaseLIMIT = 1000      //-----> here the LIMIT of your SEARCH-RESULTS in DB!
var REPEATER = "repeater2"    //-----> here the ID of your used REPEATER! (without #)
var DDprefix = "dropdown" //rename related dropdowns, like shown DDprefix -> dropdown)
//----------------------------------
DropDowns[0] = "site"  ;       //column in your DATABASE
DropDowns[1] = "location"  ;   //column in your DATABASE 
DropDowns[2] = "advisor"  ;    //column in your DATABASE 
DropDowns[3] = "undefined"  ;  //column in your DATABASE 
DropDowns[4] = "undefined"  ;  //column in your DATABASE 
DropDowns[5] = "undefined"  ;  //column in your DATABASE 
DropDowns[6] = "undefined"  ;  //column in your DATABASE      
DropDowns[7] = "undefined"  ;  //column in your DATABASE    
DropDowns[8] = "undefined"  ;  //column in your DATABASE    
DropDowns[9] = "undefined" ;  //column in your DATABASE 
//------------[User-Interface-----------------------------------------------------|


//------------starting CODE-part when page loads.....
$w.onReady(function () { 
   load_uniqueTitles_DropDowns();
  
  //-----> SITE-DropDown-------
   $w('#sitedropdown').onChange(()=>{console.log("Site-DropDown clicked")
      MEMdropdowns[0] = $w('#sitedropdown').value
      $w('#sitedropdown').enable();
      FILTER_ENGINE() 
   })   
 //-----> LOCATION-DropDown-------
   $w('#locationdropdown').onChange(()=>{console.log("Location-DropDown clicked")
      MEMdropdowns[1] = $w('#locationdropdown').value
      $w('#locationdropdown').enable();
      FILTER_ENGINE()
   }) 
 //-----> ADVISOR-DropDown-------
   $w('#advisordropdown').onChange(()=>{console.log("Advisor-DropDown clicked")
      MEMdropdowns[2] = $w('#advisordropdown').value
      $w('#advisordropdown').enable();
      FILTER_ENGINE()
   }) 
});

//-----loading of DropDown-Unique-Titles for all given DropDowns.....
//----->DO NOT TOUCH OR CHANGE THIS FUNCTION.
async function load_uniqueTitles_DropDowns() {
 console.log("Load uniqueTitles for DropDowns")
 let dbDATA = await wixData.query(DATABASE)
 let Options = []

 for (var a = 0; a < DropDowns.length; a++) {
 if(DropDowns[a]!==undefined && DropDowns[a]!=="undefined" && DropDowns[a]!==null) {
 await dbDATA.distinct(DropDowns[a])
            .then((results) => {
 let items = results.items
 console.log(items)
 
 for (var b = 0; b <items.length; b++) {
                    Options.push([])    
                    Options[a].push({"label": items[b], "value": items[b]})
                }
                $w('#'+DDprefix+(a+1)).options = Options[a]
                $w('#'+DDprefix+(a+1)).placeholder = DropDowns[a]    
            })
        }       
    }   
}
 
 //----->DO NOT TOUCH OR CHANGE THIS FUNCTION.
 function FILTER_ENGINE(){
 let query = wixData.query(DATABASE).limit(databaseLIMIT)
 
 //Filter-DropDowns-------------------------------------------
 for (let i=0; i < DropDowns.length; i++) {
 
 if (MEMdropdowns[i]!==undefined && MEMdropdowns[i]!=="undefined"){
            $w('#'+DDprefix+(i+1)).value = MEMdropdowns[i]
            query =  query.eq(DropDowns[i], MEMdropdowns[i])
        }
    }
    query.find()
    .then(async res => {
 let itemData = await res.items          
        console.log(itemData)
        $w('#'+REPEATER).data = itemData    //---> # <---- already include here
    })
}

Just Copy&Paste this code to your page and rename your DropDown-Prefixes—> to —> “dropdown” and hope, that i did not forget something or wrote an syntax-error :wink:

Check also the CONSOLE !

Good luck and happy coding!:wink: