Validate repeated elements more than 3 times in a database

Hello community, I have the following case, I have a database with one column, I need to validate that the numbers are not repeated more than 3 times

For example.
Column
1234
1355
1567
1234

If an element is repeated more than 3 times send a registration message, if the element appears less than 3 times load them to a queue.

@alexis.mendoza.rpa

Onnce you get all the values into datatable you can use linq query to get the required values

For less than 3 …dt.AsEnumerable.GroupBy(function(x) x(0).ToString).Any(function(x) x.Count<3) this gives true or false if atleast one value exists with count<3

And to bet all those values into separate datatble requireddt = dt.AsEnumerable.GroupBy(function(x) x(0).ToString).Where(function(x) x.Count<3).Select(function(x) x.First).CopyToDataTable

Similarly for greater than 3

Cheers

@alexis.mendoza.rpa,

You can follow this simple approach.

  1. Get unique numbers
  2. Iterate through unique id’s
  3. Get count of each item.
  4. Take action as per your requirement.

Sample Solution:

Sample Code:
UniqueValues.xaml (12.3 KB)

Thanks,
Ashok :slight_smile:

I think I didn’t explain myself well

I have 2 xml files

In both I have registration numbers

What I need is to validate how many times the same registration number from one file appears in another.

For example

File 1
image

file 2

What I need is to know how many times each record from file 1 appears in file 2