0

My Synapse notebook returns an array, [1, 2] I would like to Iterate through each element using foreach activity, How do I convert it to a array from string, so foreach activity runs for each element.

to keep it simple, I have created pipeline as below (hard coded the values for now)

Here are the pipeline parameters

enter image description here

For each activity properties, I used @array, but it is not parsing each element.

enter image description here

Here is the Set Variable1 activity, inside foreach activity.

enter image description here

When I debug it is taking still taking it as string.

enter image description here

Can someone please help me, how to iterate through each element?

Aswin
  • 4,090
  • 2
  • 4
  • 16
subro
  • 1,167
  • 4
  • 20
  • 32
  • If you are forced to store the results of the Notebook as a string variable - then you might need to convert the string to an array first? (before you can use it in a ForEach activity) One way to do it, would be to create a new VARIABLE of Type ARRAY - and have a SET VARIABLE Activity use something like: @split(replace(replace(variables('arr'),'[',''),']',''),',') - that will get rid of the square brackets, and split the string into an array. You can now use that new Array Variable in your ForEach – Celador Aug 15 '23 at 09:51

0 Answers0