Variable substitution in multiple choice list
# 🤝help
r
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”]} ]
2 Views