How to assign a row to a data-table if the name of the datatable name is broken up into two separate variables

So as the title suggests, I have a datatable, io_DT_1, which has a bunch of data in it that is pulled from a specific column in an excel sheet. That datatable contains the different offices in which each row of the excel file exists. io_DT_2 is supposed to receive certain rows from that datatable. io_DT_1 has things like ADMIN, CPD, etc. Each of these offices has a separate datatable it should be stored to.

After a few operations are performed, a datatable consisting of a bunch of values is populated, and I’m trying to write that datatable to a separate one. The only issue is, when I pull up an assign activity to try and assign the row I’m working on to this specific datatable, it breaks. Right now I have it set so that it is trying to write to a new datarow and assign it to one of these datatables based on the office it belongs to. I have ADMIN, CFBI, etc. stored as the offices.

The only issue is that, due to required naming conventions, I need to have the “io_Output_” string in front of the office names as the name for the datatable. However, when I try to do so,
assign left
It throws out an error because I cannot assign a datarow object to what UiPath interprets as a string. Is there a work-around for this?


If you have a finite list of different scenarios, you can use Switch or Flow Switch to split your workflow based on the combination:

Since there’s only one variable involved and I assume rest of the sequence is the same, Switch might be more useful than Flow Switch. It is used here just for illustration.

And for the issue of datarow not being cast to String, you could use the Switch activity to assign a temp table which gets a reference to the actual table specific to the name.
i.e. In the Switch case io_DT_HUD
Assign → tempTable = dt_HUD (assuming dt_HUD is the table corresponding to the row io_DT_HUD from io_DT_1)

Do the operations on tempTable and in the end, use the same switch to assign the tempTable back to your switch-based table, thereby saving the calculations.