Could anyone give me a hand with the syntax for the following function please ?
In dtData I need to update the values for a couple of columns.
I need to loop on each row of dtData and if the row index > 1 then the value of a specific column should be reassigned as follows (So the new value should replace the old value in the same DataTable):
@supermanPunch it is using an assign activity inside a for each loop.
What I want is to assign the values to the data table through a linq expression (without using loop activities). It is way faster while we have a large amount of rows in the data table.
Thanks to the documentation of @ppr I managed to to create an expression which does what I need, but I have to do some additional tricks.
Expression :
Assign left hand value : dtData
Assign right hand value :
(From row In dtDataInitial.AsEnumerable()
Let newField = “=” & row.Field(Of String)(1) & row.Field(Of String)(2)
Let rowArray = row.ItemArray.Take(9).Append(newField).ToArray()
Select dtData.Rows.Add(rowArray)).CopyToDataTable()
Inconvenients :
use a second DataTable
add the modified column at the end of the DataRow
reorder the column at the desired position
Would someone have somme suggestions to update the values in the same dt ?
How about updating the values of 2 columns within the same loop ?