https://discord.gg/botpress logo
thank you!! and would this work in case
# 💻developers
f
thank you!! and would this work in case one of the variables wasn't filled? meaning, would this code be dynamic according to whether workflow.data has 2 keys or not?
w
no in this case is semi-dynamic because we use variable, but we write element we want manually. If an item is empty the button will have no text or an error may occurs You need to normalize your data using a execution code, you need an array with 1 dimension and only the value of [n][1] using nested for.
to create code you can ask to AI of execution code or write it yourself
f
that's very helpful @white-nest-40686
would this normalisation make it 100% dynamc?
also, how would you prompt the AI?
f
yes, I'm aware of that feature, I was just asking how would you prompt it because I didn't really get it from your messag
I'm not that technical with these terms
w
try this: i have an array of array and need all the value of the second array at index 1
@future-london-98958 if your element contains empty string you could ask: i have an array of array and need all the value of the second array at index 1, i don't want empty string
probably you need a new workflow variable, of type array, where store data to use in multiple choice card. If your variable has name
workflow.options
in your multiple choice field write
{{workflow.options}}
Copy code
ts
const tmpData = workflow.data

const result = tmpData
  .map((subArray) => subArray[1]) // Get the second element of each sub-array
  .filter((item) => item !== undefined && item !== null && item !== '') // Filter out empty strings

workflow.options = result // Return the modified result array
f
thank you so much! @white-nest-40686 truly a helpful person
I just wish there were more people like you in this server!! Awesome
w
for sure, and with very high human & tecnical skills, i'm new here 😁
2 Views