Datatable Manipulation To Converge Specific Rows of a Specific Column


I have two datatables one which is the original and I take a few rows from there and work on it (by creating an auxiliary datatable), I update the status on the dt_aux and would like to update those statuses on the specific rows I worked on in the original datatable.

Image Below
To help understand, I have table 1 Original
Then I filter the NULL rows to table 2
Work on them and update status to OK
Then I want to update those statuses on the Original Datatable

Is there a way that I am not seeing?
I thought of taking out the NOKS from original and then adding them back in but if I have no NOK an error might occur cause I cant write an empty dt.

Appreciate the help.


How about simply using ForEachRow activity?

Or if you are concerned about throughput, the following might be better.

dt.AsEnumerable.Where(Function(r) r("Status").ToString="NULL")

Both workflows are included in the following file. (5.1 KB)


1 Like

Hi Yoichi,

Thank you for the reply,

My issue is to find a way to cross reference the work that I will do in my dt_aux, your answer would work if every status is “ok” and unnaffected by what happens in datatable_aux. I wanted to find a way to write on status original whatever the status in dt_aux would result in as “ok” is not always the answer.

Let me know if you have any questions. Thank you again for your time!

Hi @FilipeChiou ,

If I’m not wrong, as mentioned by you in your first post, Working on the NULL rows has a Logic and the result is not always OK, Is that what was meant by your previous post ?

Let us know if you could share that logic if that is the case.

1 Like

Hi @supermanPunch, yes!

The process is:

  1. I have the original datatable with all the rows (subjects) (with default NULL status)
  2. I run through each row to verify if the rows are elegible to be worked on, the rows that arent are updated with NOK status
  3. I take the ones with NULL (which can be worked on) to a different dt (dt_aux) so I can work on them and not the ones with NULL
  4. I then update their status in dt_aux, either OK (successfully worked on) or NOK (something went wrong and they cant be successfully completed)
  5. Then in dt_aux I would have all the rows that have been worked on with updated status either OK or NOK
  6. Then I would like to update the original dt with the updated statuses worked on dt_aux (change the NULL into whatever the outcome was in dt_aux)

Hope I could clarify your points. Thank you

@FilipeChiou ,

I believe this could be done by @Yoichi 's Implementation provided above, You would just require to perform the Operation of Deciding if it is OK or not OK inside the For Each Loop and then maybe use an If Condition and decide if it is OK or NOK using an Assign Activity.

As the logic of Deciding OK or NOK is still not exposed to us, we could only maybe suggest you the approach.

Let us know if you were not able to understand the above approach suggested.



From looking through the code sent by @Yoichi I was under the impression that there is only one datatable, my issue is with synchronizing (updating) the status from one datatable (dt_aux) with another (dt_original). I would be able to do this if the dt had the same number of rows, however, due to some rows not beeing transferred to dt_aux I dont know how to change the status according to their names.

As a demonstration, after working on dt_aux, how would I update the original dt with the values coming from dt_aux I would need a way to link the names as in change the status in row with name A (original dt) with the status in dt_aux with also the name A, and from what @Yoichi sent me I dont see it, or am I missing something?

Hi, after some thought I understand the process that @Yoichi is trying to make,

However, I am still missing the assign which connects dt with the corresponding dt_aux. Which in the case of @Yoichi he just assigned to ok, is there a way to assign the value of a row in dt_aux to the dt original?

Screenshot 2023-01-26 093434

I would need a counter to match both rows, and the if loop will take out all the non NULL status values on the original.


Do you need to create dt_aux?
How about to use DataRow array as the following?

If we update content of row in the ForEach, original datatable is also updated.


1 Like

Hi @Yoichi,

I would like to apoligize, I shouldve understood your reply and think about it further rather than respond immediately (I am a beginner in UiPath), yes you are absolutely right, I dont need to create an dt_aux since I can just put an if in the for each to run only on NULL rows. I am sorry for wasting your time, I should read and understood your reply more carefully.

Lesson Learned :slight_smile:

Thank you @Yoichi and @supermanPunch for your time and help, its solved now!


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