Is it possible to prefill the dropdown from a query?
I have a query and want to fill up the dropdown with the result of the query (unique products in the table)
Is it possible to prefill the dropdown from a query?
I have a query and want to fill up the dropdown with the result of the query (unique products in the table)
Is something like this what you're looking for?

Youβre the best!. Exactly! Thanks.
![]()
@kent This isn't working at all for me
This is what I see when I reference the query I made. Am I doing something wrong here?
Some queries (usualy SQL based ones) return data as an object of arrays like this:
{ key1: [val, val], key2: [val, val] }
Which would make the selection of all of the values in an array easy as shown above, queryName.data.key1.
Many other data sources return an array of objects like this:
[ { key1: val, key2: val }, { key1: val, key2: val } ]
For this, you could either get the array of all of a certain value by using the .map() JS method, or converting it to an object of arrays using our helper function formatDataAsObject() (thereβs also the opposite as formatDataAsArray). That would look like either:
queryName.data.map(d=>d.key1)
or
formatDataAsObject(queryName.data).key1
That is wonderful!!! Thanks so much for helping me with that!!!
thanks a lot!!!
Hi all, just updating this solution to the more recent functionality! When creating a dropdown (select component), you can choose Mapped mode, enter your query as the data source, and then you can reference the {{ item }} for whichever values you want to use, like item.name for the label, item.email for the caption, item.id for the value, etc.