Passing Array individual Values to a variable


I have an array named anArray = {“Value1”,“Value2”,“VAlue3”}

I used For each to loop and read every one of them

For each item in anArray

I created 3 variables named strValue1, strValue2, strValue3

My question is how can I pass it in those variables?


Hi @alvin.c.apostol26

In your for each loop, use an Assign activity. In the assign activity, under the value, provide the code below


and on the left, have your variable to assign the value to.

Make sure your For Each loop should be of type String. Below is one string type loop that I have in one of my workflows.


  • For each item of array
  • Define a counter with 0
  • If counter is 0 then add to first variable, else check for if counter 1 or 2 or etc other variable with multiple if
  • After if condition increment counter.
  • next loop check for same condition

Let us know if this helps,
Pavan H

1 Like

HI @alvin.c.apostol26

Jsut went through your problem again… If your array has only three values, and you have only three variables, instead of using a loop, we can use the below method without using a for each loop

  1. Have three assign activities

on each add the below code to assign the values to three variables

Value 1

Value 2

Value 3

I think this approach is much efficient rather than looping through if you have only three fixed values in the array


Thank you guys! it worked!

1 Like