Add value to a column in DataTable for each row

Hello Everyone,

I am developing a RPA script where i am trying to add System Date as value to a new col in a datatable.

  1. So far I have read the excel document and stored the value in datable variable draftDT.
  2. Captured the system date into a variable
  3. Added a new column to draftDT datatable.

Now i am stuck at a point as to how to add this system date value to each row of my Datatable.
May be i missing some simple thing.

Any help is appreciated.
Thanks.

@ajagtap636

Use Add DataRow activity and pass date and other row values into ArrayRow field and also pass DataTable as draftDT

          {"ColumnValue1","ColumnValue2",varDate.ToString("dd/MM/yyyy"}

Hi Lakshman,

Thanks for your response.
As i am reading from the excel which has data, my datatable already has the data.
I just need to add a sysdate value in the new col against each row.

@ajagtap636

Is something like this what you are looking for? This would have each row iterated through, and assign the system date to the new column (make sure to replace the “sysDateColumn” with what your column name is) for each row.

image

1 Like

@ajagtap636

Keep Add DataRow activity inside ForEach Row activity. Pass ArrayRow as below in Add DataRow activity.

         {change("Column1").ToString,change("Column2").ToString,....,currentDate}

Perfect, this is what i was looking for.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.