Good evening Ninja,
Thank you again for your feedback! I have entered the code and have no reported errors, but am getting no response when I run the code in preview. There is no change that occurs with the Repeater
import wixData from ‘wix-data’;
var DBFIELDS=, DD_ID=, OUTPUT_FIELD=;
//-------- USER-INTERFACE -------------------------
var DBLIMIT = 1000;
var DATABASE = “Items1”
//—[ Dropdown-Settings]---------------------
DD_ID[0] = “#stateDropdown1”
//—[ DB-INPUT-Field-Settings]--------------
DD_ID[2] = “#cityDropdown2”
// <–setting Dropdown-ID here…(2nd. dropdown)
DBFIELDS[0] = “state”
//—[ DB-OUTPUT-Field-Settings]--------------
DBFIELDS[2] = “city”
// <–setting DATABASE-Field-ID (2nd. DB-Field)
OUTPUT_FIELD[0] = “DBFIELDS[0]” //<— DEFINE-OUTPUT-FIELD-here
//-------- USER-INTERFACE ---------------------------
$w.onReady(async()=>{
let ITEMS = await get_DBdata(DATABASE);
create_UniqueDropdown(ITEMS,DBFIELDS[0],DD_ID[0]);
$w(DD_ID[0]).onChange(()=>{
let INDEX = $w(DD_ID[0]).selectedIndex
console.log(ITEMS[INDEX][OUTPUT_FIELD[0]]);
});
});
//—First ACTIVATED-Dropdown…
function create_UniqueDropdown(items, dbfield, dropdown) {
const uniqueTitles = getUniqueTitles(items);
$w(dropdown).options = buildOptions(uniqueTitles);
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item[dbfield]);
return […new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
function get_DBdata(DATABASE) {
wixData.query(DATABASE)
.limit(DBLIMIT).find()
.then(results=> {
let ITEMS = results.items
return (ITEMS)
});
}
//—Second ACTIVATED-Dropdown…
$w.onReady(async()=>{
let ITEMS = await get_DBdata(DATABASE);
create_UniqueDropdown2(ITEMS,DBFIELDS[2],DD_ID[2]);
$w(DD_ID[2]).onChange(()=>{
let INDEX = $w(DD_ID[2]).selectedIndex
console.log(ITEMS[INDEX][OUTPUT_FIELD[0]]);
});
});
function create_UniqueDropdown2(items, dbfield, dropdown) {
const uniqueTitles = getUniqueTitles(items);
$w(dropdown).options = buildOptions(uniqueTitles);
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item[dbfield]);
return […new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return {label:curr, value:curr};
});
}
}
function get_DBdata2(DATABASE) {
wixData.query(DATABASE)
.limit(DBLIMIT).find()
.then(results=> {
let ITEMS = results.items
return (ITEMS)
});
}
Here’s how the screen shot of the code looks:

How is this able to connect to Repeater?

