Programatically populate multiple choice
# 🤝help
c
Hi how do I having made a calll to an api and populated an array. How can I sue the contetnts of the array to populate a multiple choice card? Thanks
a
Hello again @clean-branch-56468! It's not pretty, but this is how you can do it right now. Basically you need to prepare your choices array in a very specific schema ahead of time, then pass it to a single choice capture card. I say "right now" because a better way to do this is in the works. Good luck!
BTW here's the code from my card:
Copy code
workflow.multChoiceQuestion="Please pick an option"
workflow.multChoiceOptions=[
    {
        label:"a",
        value:"a"
    },
    {
        label:"b",
        value:"b"
    },
    {
        label:"c",
        value:"c"
    },{
        label:"d",
        value:"d"
    }
]
also note that the choice array is surrounded by two {{curly brackets}} and one [square bracket] in the capture card
c
Thanks. And I presume you have to create the
multChoiceQuestion
as a variable of type array in advance in the main workflow properties?
a
if you want to, yeah. It's not required but it does help keep the screen free of warnings 😛
34 Views