Filter Datatable when number of columns, column names are not fixed

Hi,

I have 2 datatables (see below). I have to get the rows from DtEmployee and see if they exist in DtOrg. So here I need to see if there is any row in DtOrg which has Id =1 and Location = xyz.

  1. DtEmployee -
    |Id|Location|
    |1|xyz|

  2. DtOrg -
    |Name|Dept|Id|Manager|Location|
    |Jack|INS|1|Rick|xyz|

Issue here is DtEmployee table does not have fixed column names nor it has fixed column number. So there can be possibility that DtEmployee looks like this -
|Id|Location|Manager
|1|xyz|Rick

So, in this case I need to see if there is any row in DtOrg which has Id =1 and Location = xyz and Manager = Rick

Please help on how can i achieve this dynamic datatable filterring.

The number of columns is irrelevant. You reference the columns by name so as long as there is an Id column it will work.

if there are 3 columns appearing in DtEmployee then I have to filter DTOrg on those 3 columns. So this is becoming a issue

Will Id always be a column in DtEmployee?

No, thats not the case always

Is your goal simply to get a yes/no answer to “does this record in DtEmployee exist in DtOrg” or are there other things you need to do?

Just a yes/no answer

Here you go.

I used UiPath.System.Activities 24.10.4 but should work on pretty much anything, it’s just basic activities.

This dynamically builds a .Select query based on the common columns, then queries DtOrg.

Main.xaml (23.5 KB)

1 Like

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