Create datarow for datarow dynamically depending on array length

I would need to create a datarow for a predefined datatable everytime i loop into an array. Something like below

when count =0

dataRow = dt.NewRow()


dataRow1 = dt.NewRow() and goes on…

Appreciate any help on this

array.Length will give you the total no.of rows available in array.
Use For each Loop activity to loop from 0 to array.Length-1


  1. Use for each activity to loop into each elements of the array.
  2. I believe when you say create a datarow, you might need to add it to the datatable. In that case, you can use Add Data Row activity and specify the columns as objects in the ArrayRow property.
    otherwise, if your requirement is only to create a newRow, under DataRow property in Add Data Row activity, type .NewRow => dt.NewRow

Hope this helps! Let me know if you need more elaboration on this.

Looping is already done. Rather i need to create a new datarow with a new datarow name everytime it loops into the array

Thank you for your response. The first step is already done and the second step is also done partially. My requirement is to create a new datarow with a unique name everytime it loops in the array.

unique name on any column?

As i posted in my sample

when count =0

dataRow = dt.NewRow()


dataRow1 = dt.NewRow()

count =2
dataRow2 = dt.NewRow()

count =3
dataRow3 = dt.NewRow()

The flow i explained already creating a new row. Only difference here is, left hand side you are creating a new variable every time and assigning the new row generated.
If you know exact number elements in the array and that never changes, you can create those many variables and assign. But dynamically creating a variable is not possible. Instead you can use a list or dictionary to add the newly generated rows.
Please check below workflow. Let me know if your requirement is different.
Testing.xaml (14.9 KB)

Thank you for your response.As you suggested i can add the datarow to a list and iterate to add to a datatable. But as you doubted the the number of elements in the array is not constant. If creating a new variable is not possible can we clear the existing datarow values and reassign the variables to the same datarow.

Instead of adding to list, add to datatable itself. Testing.xaml (16.0 KB)
I have updated the code to add empty row.
Also added template how you can add new row with value (Commented activity inside for each - 2nd approach)

let me know if this is what you are looking for.

Thank you again for your prompt response. Something of similar kind is what we have developed. The problem is that we add datarow with columns and utilise it a later time. Once we add the datarow, is there a way to clear the datarow and add values again to the same row. Have attached the sample how we require.test.xaml (8.7 KB). Ignore the first initialize data row

When you are adding row, you can add a empty row or a row filled with data.
If you want to update these column values later, you can use dtTable.Rows(<row_Index>)(<Column_Name>) =

Please refer TestRuns.xaml (20.8 KB)

Hope this helps!