Populate select component with javascript by different queries

I have a form with different fields. One field is a select component, which values should be different by context of the form. So i use a javascript as a data source for this select component.

Based on context i want to trigger totally different postgresql queries (different tables, different joins) to fill the values. If you want a factory approach.

In my first step i simply try to run one query within the javascript and return it to the select component, but i get "The selected data source is empty or could not be converted to an array." In JS console the data is not empty, so i guess that the format is not matching. I tried formatDataAsArray and the map function in different styles but i missed something and its not working.

You could use the Fx switch for the select component and add{{[query21.data]}}

1 Like

Hi @ScottR many thx for your reply. I solved it now, but your hint was not the cause.

Instead of

await bcHierachySelect.trigger({

i must use

return bcHierachySelect.trigger({

of course ^^

now both ways with "data source select" and your fx hint is working.

all the best & thx

1 Like

Thank you so much for sharing the solution here where it can help others searching for an answer to a similar issue, @Thomas_K !