How to populate a datatable based on an other one

Hello

I initialize a datatable in the beginning of my process : DT1
I want my DT to only have one row

I have two cases based on a condition :

either all the values of the first row are null and are populate throughout the process

either i will retrieve data and populate my DT in the beggining

however i do not know how to make sure i always have one row.

because if i have an empty data table in the beginning, the robot will give me a null exeption when i try to check the data

but if i add one row, then i don’t know how to update this row.

this is what i do now but it adds one row. i want to update the existing one

The image shows a loop activity in a workflow, iterating through each row in a DataTable named "ReportingDT" and adding a new DataRow to the same DataTable within the loop. (Captioned by AI)

how to transform this into update

Hi @adext
First try to resolve null exception
Have a If condition with below statement

IsNothing(your DT)

True–null
False -not null

Hi!

To update a single row datatable you can just do this:
ReportingDT(0)(“ColumnName”) = YourVariable

This will set row 0, column “ColumnName” to be the value of your variable.