Filter the Value from two files using Filter Data Table activity

I have two Excel files named File1 and File2. I want to filter the data to find matching values in both files. I am using a “For Each Row” activity along with a “Filter Data Table” activity to compare values from File1 with those in File2. If a value from File1 matches a value in File2, I want to continue processing the remaining rows. Else break.

Hi @Mohammad_Rizwan_03

Try this Linq Query

resultDT  = dtFile1.AsEnumerable().
                            Where(Function(row1) dtFile2.AsEnumerable().
                            Any(Function(row2) row1("ColumnName").ToString() = row2("ColumnName").ToString())).
                            CopyToDataTable()

Or

For Each Row in DT_File1
   Filter Data Table:
      Input: DT_File2
      Output: FilteredDT
      Condition: "ColumnName" = row("ColumnName").ToString

   If FilteredDT.Rows.Count > 0 Then
      // Continue processing
   Else
      Break

Regards,

@Mohammad_Rizwan_03

Read Range (File1) → dtFile1
Read Range (File2) → dtFile2

For Each Row in dtFile1 (rowFile1)
    For Each Row in dtFile2 (rowFile2)
        If (rowFile1("ColumnName").ToString = rowFile2("ColumnName").ToString)
            Set isMatchFound = True
            Break (Inner Loop)
     
    If (isMatchFound)
        Break (Outer Loop)
 

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