Highlight duplicate values

Hello everyone,

I wanted some help where i am stuck. The problem is in a column i wanted to highlight all the duplicate values example suppose if there is a column A and it has no. of values i want to highlight those values which appear more than once. I have attached an image for the exampleCapture

Here for ex. 5406830896 has appeared more than once so it should be highlighted.

Please help me solving this issue.

Thanks,
Shikhar

4 Likes

Hi @Shikhar_Tandon

My logic is like these .

  1. Group the value of PO to check the duplicates
    2.Use If Condition to check the value that we get in the scenario 1
    3.Create a counter while in the loop this counter will be the determinator to set in the Set Range color.

cheers :smiley:

Happy learning :smiley:

4 Likes

Hi @Shikhar_Tandon

You can try the below logic for your problem statement.

  1. Read the entire excel data using read range activity and store into dtTable.
  2. Use assign activity and try to get all unique values from the column “PO” using this command: dtTemp = dtTable.DefaultView.ToTable(true,“PO”)
    The return type will be datatable.
    This way you will get all unique rows of data with reference to “PO” column.
  3. Use For each row activity and iterate through dtTemp. Use assign activity inside that for each row, arrRows=( from dr as datarow in dtTable where dr(“PO”).ToString = row(“PO”).ToString select dr).ToArray )

The return type will be array of data rows.

  1. Check the count of each iteration and if count is greater than 1, you can store or highlighted those values.

Let me know if you’ve any doubts. :+1:

6 Likes

Thanks a lot ! @singhonkar :grinning: btw can you please explain the query at point no. 3

thanks,
Shikhar

@Shikhar_Tandon

That one is Linq query. It’s used to retrieve the data from the dataset. You can go through the below website to get the basic understanding and then start implementing in UiPath.

https://www.codeproject.com/Articles/286255/Using-LINQ-Queries

Hi @singhonkar,

It would be a great help if you could share a xaml related to the topic as my code is not working today. iterating over increased counter is giving all the values and the arrRows variable is containing all the values of the column PO not only the condition based values.

Thanks,
Shikhar

@Shikhar_Tandon

Can you please share your xaml code so that i can go through and look into it.

Hi @singhonkar,
i have attached the Xaml ,
Also i would like to add when iterating, for testing purpose, over arrRows variable using a for each loop with type argument as datarow array type and displaying the item by item(0).toString the values obtained are not as mentioned in the condition of arrRows their are all values coming which belong to dttemp. Please help.

Thankyou,
ShikhartestPo.xaml (8.6 KB)

@Shikhar_Tandon
Please find the attached file and test it. Let me know if this works.testPo.xaml (8.5 KB)

Hi @singhonkar,

Thanks Buddy its working,
Can you please tell the mistake in my code.

Thanks,
Shikhar

@Shikhar_Tandon

You were using count variable logic to count the no. of occurences separately and i’ve used Count property of array to count the no. of PO values in array. No need to perform separate logic.
Please mark it as solution as it may help others. Cheers!!

1 Like

Thanks!! @singhonkar but i didn’t get why the count logic of mine failed.

1 Like

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