Is it possible to create a âSingle Choiceâ prompt dynamically in code?
Iâm trying to create a flow that stores a list of multiple choice questions and loops through them until all are answered - but substitution doesnât seem to work on the choices.
Hereâs a simplified example. In this list each line contains a question (q), a variable name to store the answer in (v) and the choices I want to present to the user (o).
Each iteration of my loop searches through the list of questions and when it finds one that hasnât been answered yet, it sets ânextQuestionâ, ânextVarnameâ and ânextOptionsâ to the appropriate values.
I can substitute the question easily enough, but substitution doesnât seem to work for the 3 choices Iâve created. If I get rid of the multiple choices and use raw text, it works - but Iâd really rather be able to present buttons for the user to click.
I suppose I could label each option as 1,2,3 or A,B,C but that feels like cheating.
What would it take to enable substitution in the list of choices? Is there a way to do this already that I donât know of?
const Questions = [
{q: âGreen, Red or Blue?â, v: âchoiceColorâ, o: [âgreenâ, âredâ, âblueâ]},
{q: âWhich size?â, v: âchoiceSizeâ, o: [âsmallâ, âmediumâ, âlargeâ]}
]