Thank you! This is exactly what i am looking for.
Need to make a slight change in the code at the end.
I am pasting my code here in case anyone else needs it.
//code for array options dropdown
function loadOptions() {
// Run a query that returns distinct items in the collection
wixData.query( “AllProviders” )
// Set the course as the field that must be distinct
.distinct( “multiCity” )
.then(results => {
// Call another function to reformat the distinct items
// the way the dropdown element expects
let distinctList = buildOptions(results.items);
// Use unshift() to add another dropdown option at
// the beginning of the array, in the correct format
distinctList.unshift({ “value” : ‘’ , “label” : ‘All Cities’ });
// Set the options of the dropdown
$w( “#multicitydropdown” ).options = distinctList;
});
}
//THIS PART IS SLIGHTLY DIFFERENT FROM WIX CODE
function buildOptions(items) {
return items.map(currentItem => {
return {
label:currentItem, value:currentItem
};
});
}
$w.onReady(() => {
loadOptions();
});