I must be honest, i did not invest much time to analyse your issue.
It was just the first what was on my mind.
But you always will be able to find a solution, if you really serach for it.
There are 100 of ways, how to solve a problem, with different methods.
Without to dive to deep into your issue, maybe this one also could be interesting for you…
Showing UNIQUE-VALUES is almost nothing else then remove dublicates, right?
As you can see, i also struggled with similar issues, but i have created my own QUERY-SYSTEM, which can do all the magic.
Good coding-results —> needs time.
Take your time and create your own solution.
Back to your topic…
As you can see, in this example, you do not need a → DISTINCT() <—, which means, that you can use FIND() again, right?
async functioncreate_UniqueDropdown(items,DBFIELDS,dropdown){
console.log(items);
constuniqueTitles=awaitgetUniqueTitles(items);
console.log("Unique-Titles: ",uniqueTitles);
$w(`#${dropdown}`).options=buildOptions(uniqueTitles);
//console.log("OPTIONS: ", buildOptions(uniqueTitles));
async functiongetUniqueTitles(items){
lettitlesOnly=awaititems.map(item=>item[DBFIELDS]);
//console.log("Titles-Only: ", titlesOnly);
return[...newSet(titlesOnly)];
}
functionbuildOptions(uniqueList){
returnuniqueList.map(curr=>
{
return{label:curr,value:curr};
});
}
}
Good luck!