Add row to DataTable using the Invoke Method


I’ve created a DataTable (dttLog) and a DataRow (dtrCurrentLog).
Now i want to add the row to the data table.
I used the Invoke method as shown below:

This works perfect!

Now I was wondering why is it not possible do the same by using a assign statement as shown below?:


This is probably the reason to use an invoke method, just learning new stuff and I base myself on a script from someone else.

Thanks in advance!

1 Like

Hi @MTS,

You can not use DataTable.Rows.Add(Row) in assign statement because this method will not return any value to assign to the variable in the left hand side of the Assign activity.
However, You can use add method with the array of objects that define the row as parameter
DataTable.Rows.Add({“Column1Value”, “Column2Value”, “Column3Value”})
This method will return Row object as the value to assign into the left hand variable.