https://discord.gg/botpress logo
#🤝help
Variable bug on single select
# 🤝help
g

gifted-flag-55082

07/12/2023, 2:21 PM
Hello everyone, I have a bug when placing a variable in the single selection, this image appears below:
a

ancient-coat-12934

07/12/2023, 2:25 PM
@early-train-33247
e

early-train-33247

07/12/2023, 5:16 PM
Hey guys! This is happening because the Items variable needs to follow a specific format, it must be an array of objects with this structure:
Copy code
js
{
 label: "Segunda-feira",
 value: "monday"
}
g

gifted-flag-55082

07/12/2023, 7:16 PM
Hello! The error occurs the same way using this structure. What I need is to put a variable in the option.
e

early-train-33247

07/13/2023, 3:00 PM
Probably because you used the same code I gave you, the Items input needs to be an array. So in a Execute Code will you need to build the workflow.segunda list with objects formatted like above:
Copy code
js
workflow.segunda = algumaLista.map(item => {
 return {
  label: item // aqui depende do tipo da variabel item, se for uma string pode ser assim, se for objeto tem que falar o parâmetro (item.nome)
  value: item // mesma coisa, mas o value é o que passa a ser o valor da variável que você está capturando com choices   
 }
})
5 Views