I am trying to use a for each loop to go through each row of a data table, add a couple of columns to the row, and then put the Array Row into a different data table. I have done this before but cannot remember how to do it. The error I am getting is that there is an identifier expected but I do not know what I am missing. Please help
Hi @jpreziuso
Are u trying to put all the rows in another datatable
Then use
row.Itemarray in array section
Or u can specify like this too
{row(0).ToString, row(1).ToString…}
I want to move all the rows into another datatable but I have to add some columns to the row before I do. I have to add the two blank columns and the “In Progress” column that you can see in the screenshot.
Hi @jpreziuso add like this
{row(0).ToString,row(1).ToString,row(2). ToString,row(3).ToString,row(4).ToString,row(5). ToString, “”, “InProgress”,row(6).ToString}
Hope it helps
Mark it as solution if you got it
Regards
Nived N
Happy Automation
That seems to have helped slightly but now I am running into this issue
I know this means that there is a blank value somewhere that is not assigned but I am not sure where. I will look into it
Hi @jpreziuso
Are u using add data row inside the for each ?
Can u share the screenshot of Workflow if possible
If you loop each row of datatable “dt” and want to add a row to 2nd datatable “dt2” you can do this, → use add data row activity, pass in row.ItemArray!
(Note: for this to work dt and dt2 should have the same headers)
Hi,
- From your initial question
because you have a dot between Rows and (row)
and you should write Rows(row) not Rows.(row)
2) Are you sure your variable row is an integer, not a DataRow?
You can get an index of the row with this property
(but I recommend you use this notation)
- You should use Build Data Table activity before adding new rows to avoid this problem