Sometimes you may need to have a replacement code if something do not work like expected…
Anyway, surely anthonyb is right and using distinct the is better way to go, but on my opinion not a must.
Found an old post of myself about distinct here, perhaps it can help you understanding —> distinct, better.
https://russian-dima.wixsite.com/meinewebsite/test-test-test
And here an little example of a DropDown-Distinct…
var DDprefix = "DD" ; //setup-8 -----> DropDown-Prefix (DropDown-Element-ID)
DropDowns[0] = "insert --->DATAFIELD-ID-1 here for this DROPDOWN"
DropDowns[1] = "insert --->DATAFIELD-ID-2 here for this DROPDOWN"
DropDowns[2] = "insert --->DATAFIELD-ID-3 here for this DROPDOWN"
//------------------[ Create - Dropdowns ] ----------------------
async function create_DropDowns(dbDATA) {console.log("LOAD DropDowns")
let Options = []
for (var a = 0; a < DropDowns.length; a++) {
if(DropDowns[a]) {await dbDATA.distinct(DropDowns[a])
.then((results) => {let items = results.items
if (items.length > 0) {
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]
}
else{ }
})
}
}
}