Excel column filterig and updating values after checking only one record exists for each ID - Problem

Hi, I am new to UIPath and I am facing the below problem :
I have two excel documents - from excel 1 I am to pick up an ID and check if it is present in excel 2. If present update a couple of columns on excel 2. But the search would be such that first I have to filter three columns in excel 2 and if only ONE record for that particular ID is present in excel 2 only then I will be updating excel 2 columns for that ID, else move to the next ID, or end the process if there is no other IDs in excel 1.

Now in my code that I have created another row is getting added in excel 2 for that ID after adding the filters, where the update is taking place. But I need to update the same row and not have another row added.

Below is my code:
In an assign activity I am putting below logic for filtering (when FilterColumn1 and FilterColumn2 are “Yes” and FilterColumn2
3 is “Blank”)

dt_OutputData.Select(“[ColumnToBeUpdated ID] = ‘ABC’”).CopyToDataTable.Select(“[FilterColumn1]=‘Yes’). CopyToDataTable.Select(“[FilterColumn2]=‘Yes’). CopyToDataTable.Select(“[FilterColumn3]= ‘“+string.Empty+”’”). CopyToDataTable

Then I am adding the below If condition:

Then update the ID columns of that row.

I am not putting the logic for the updating part here as it is working as expected if I don’t add the filter logic (the assign and IF). No second row is getting added. It is only when I put the filter logic another row is getting added and the update is happening there. So I am thinking that the issue is with the filter logic. Hope I could explain properly the issue.

Please help. This is my first question here and I have to solve this. Thanks in advance!


Welcome to forums

It’s better if you can prepare a sample Input and output required files
So that It’s easy to understand your issue


Hi, I am putting in simple values with a little explanation.

In excel1 I have an ID ‘ABC’. In excel2 I have to find that ID after applying filters and then make update in some columns

Below is my code:
In an assign activity I am putting below logic for filtering DT (when col1 and col2 are “Yes” and col3 is “Blank”)

dt_DT.Select(“[ID] = ‘ABC’”).CopyToDataTable.Select(“[col1]=‘Yes’). CopyToDataTable.Select(“[col2]=‘Yes’). CopyToDataTable.Select(“[col3]= ‘“+string.Empty+”’”). CopyToDataTable

I am then adding the below IF condition:


If only 1 row count is found for that ID Then update the columns for the ID