Hi all,
Here is my situation:
category is a Reference field Key in dataset1 , receiving its data options from title field in dataset2 .
Dropdown1 is populated with the category field data, only instead of the data Labels (string), the Dropdown displays the data ID’s (GUID).
What should change so that the dropdown will display Labels instead of ID’s?
Thank you!
The code:
function uniquefieldDropdown() {
wixData.query("dataset1")
.limit(1000)
.find()
.then(results => {
const uniqueTitles = getUniqueTitles(results.items);
$w("#Dropdown1").options = buildOptions(uniqueTitles);
});
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.category);
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return { label: curr, value: curr };
});
}
}