Issue in datatable comparision

i want to scrap comments the first page of Amazon.in then i want to check the whole scrap data from 1st page is present in data base or not.
this is the result of my 1st page scrap data.
image
i want to compare based on title,posted_by,review and product_id.
if all data(title,posted_by,review and product_id.) from first page is present in database then close the tab. if one or more unmatched row found in the first page then i want to go for next page and scrap the second page and check the scraped data from second page is present in data base or not. And the same process i want to repeat. how can i do this?
Thank u.

@arijit1213

have a look on following demo, finding

  • finding new rows by comparing all columns
  • finding existing rows by comparing all columns

FindMatchesNonMatches_AllColsCheck_SequenceEquals.xaml (16.6 KB)

as it is based on a SequenceEqual it is not necessairy to specify all columnnames or indexes for the check. But it is mandatory for its correctness that both datatable will have the same column structure.

Let us know your feedback

1 Like

hi @ppr
can you please modify this query -(From dn In dtNewSet.AsEnumerable
Where Not dtOldSet.AsEnumerable.Any(Function (x) x.ItemArray.SequenceEqual(dn.ItemArray))
Select dn).toList
i want to compare based on (title,posted_by,review and product_id) this columns.

Hi @arijit1213
concatening the filter columns like x(ColName1).toString.Equals(dn(ColName1).toString) AND x(… AND … is not really nice to read and to manage.

An approach with a configurable ItemArray filter was setup with following building blocks:

in the FilterColSet variable the Columnnames are defined which are to use for filtering

getting new Rows:
grafik

Line 1: iteration over dtNewSet Table
Line 2: tempVar the filtered ItemArray of dn
Line 3: creating also a filtered ItemArray for the checked rows in dtOldSet and checks withSequenceEqual against ma

Find demo XAML here
FindMatchesNonMatches_ColSetCheck_SequenceEquals.xaml (17.2 KB)

Also have a look on the Join DataTable activity

1 Like

Thank u.

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