Hello, I am trying to create a sequence that will replace NAICS Codes in one Datatable with their names in a reference datatable. For example, the main datatable has NAICS codes 00-99 in the column “Names” and the reference datatable has two columns one is “Code” which has the same format between 00-99 and the other is “Name” which provides the name of the industry such as CODE “11” NAME “Agriculture, forestry, fishing and hunting”,
hi @holdingscommand,
Welcome to the Uipath Community !
We have a activity Called Join DataTable-
Provide both the DataTables in Input . In the Join Type - It will be Inner and Column Table 1 and Column Table 2 will be columns macthing in both DataTables
–
Mukesh
@mukeshkala
Yes, I need to specifically replace the values per row that match the values in the other datatable. Not join the two datatables. As I said, DataTable one has the codes matched to businesses while DataTable two is a reference sheet of the codes which has the codes in one column and the names in the other column. I need to go through each row in DataTable one and replace the codes with the names provided in DataTable two. For example, DataTable one has Total Spent - Code - Profit columns
So as you can see DT1 has a column named NAICS2012 which provides a code. “00” or “11”. DT2 is the reference DT which provides the name that corresponds to that code. I need to create a process that will go through all rows in DT1 and replace them with the right name as referenced in DT2. So code “00” in DT1 would be recognized as matching code “00” in DT2 and would then replace “00” with the Name in DT2 which in this case is “Total for all sectors”.
Hi @holdingscommand,
WorkFlow Above is what we can have here :
- Assuming Both the Datatables are read and are in DT1 and DT2.
- We Loop for each row in DT1
- Inside Loop - we Take a Look up Range and Search the row value from DT1 in DT2. Below is how lookupdataTable should look like
- datatable where we have to serch value for
- Value we are searching for - in our case - row(" Column Name from Dt1").tostring
3.Column Name from DT2 we want to Look the value - Search Output.
so till here , we are telling uipath - For each row value in DT1 - Search DT2 for Value and If found store the value in Outputfrom DT2.
- Now in IF condition we check - If the output is available or not from DT2.
- If Avaialble - we are updating the value in DT1 using assign.
–
Mukesh
So that would match and store the Codes in outputfromDT2 and update the codes in DT1 to match the codes in DT2, but the codes already match. I need UiPath to recognize that after each Code matches between DT1 and DT2 it needs to update the value in DT1 to the corresponding row in the “Name” column from DT2 which is next to the matched Code.