Quickform Choices from Flow Variable

I would like to provide a list of choices coming from a database to the single selection node. However, it seems that arrays cannot be set through flow variables (possible_choices in the case of single selection node). Is there a work around or am I missing something? Thank you!

1 Like

Perhaps not very elegant, but what could work (at least if you have the same number of choices every time) -

Say you always have 5 choices. Make a new table for these, if it is in an array, it will be one row, one column (Column 1). Split this into 5 columns to give Column 2 to 6.

In the selection nodes flow variables, enter under "possible choices"

and in 0 use Column 2 of the split

in 1 use Column 3

etc.

For this to work though you will need to enter 5 dummy values in the selection box, otherwise you won't get 5 choices in the variable box. This is why (at least I) can't make it work with varying number of choices (a loop would normally be something useful).


 

Or you can convert the array into a comma separated string (requires a little bit of data manipulation) which you feed as a single flow variable to the single selection node (possible choices).

Docminus, yes this would work for not too many and fixed choices. The issue here is that my number of choices changes.

Geo, from what I see your suggestion could work but only for the QuickForm (legacy) nodes. The comma seperated string is easier to work with indeed.

Concluding, in my oppinion either the new nodes should work with CSV or the way of working with arrays for flowvariables needs a rework/extension. Correct?

Ok, I see your issue with Single Selection node.

How about the Value Selection node? Its description says: "Takes a data table and a selected column and returns a variable with the selected value from this column." Just extract the list of choices as a single column from the database and select the said column in the Default Column - you can even lock it from further configuration. The user can now choose one value among the available values. Voilà, n'est-ce pas?

1 Like

Hi Geo, yes, how could I have missed this node - thank you, this works perfectly! :)

However, this avoids the issue working with arrays and flowvariables. I hope I don't come accross it again.