Hey! Not sure if anyone has faced this
# general-english
m
Hey! Not sure if anyone has faced this issue or if theres a best approach. I am building a workflow where the api block returns results which is an array of objects. I am able to directly reference an element using results[0].name for ex. However I need a way to iterate through the results, until the user selects the correct result from results. I thought about hard coding a say block for each possible item of the array, but since the array size can be different theres no good way to do that. Ideally I would be able to use a for loop of sorts, even tried creating a variable index and then trying to say results[{{index}}].name with no luck. Does anyone know how I could handle this or have any best practices for working with arrays in workflows would be very appriciated.
k
Use a loop with an index variable and conditional logic in the workflow to iterate through the results array, prompting the user on each item until they confirm a selection or the list ends.
m
Amazing that's exactly what I was wanting to do. Thank you!