obviously replace all my element and database names with your own
import wixData from ‘wix-data’;
//On clickj event on the drop down button
export function longNamedropdown_click(event) {
fullNamedropdown()
}
//Fullname calculated field in the MemberProfile5 database, this is the code to create a unique drop down list. function fullNamedropdown() {
wixData.query(“MemberProfile5”)
.limit(1000)
.ascending(“fullName”)
.find()
.then(results => { const uniqueTitles = getUniqueTitles(results.items);
$w(“#longNamedropdown”).options = buildOptions(uniqueTitles);
});
//Maps unique items from “fullName” column which is a hook calculated field function getUniqueTitles(items) { const titlesOnly = items.map(item => item.fullName); return [… new Set(titlesOnly)];
}
//Builds the drop down list from unique values using current labels and titles function buildOptions(uniqueList) { return uniqueList.map(curr => { return {label:curr, value:curr};
});
}
}