Creating a loop activity that recognizes repeated value

Hey first time here!

I’m trying to create a loop activity (maybe a “do-while” loop) that will be able to recognize if the current value in the cell in column A is the same value as the one above it and if it is, then keep recording the corresponding value in column B. If it is not, then proceed to the next step.

I attached a picture of the columns below. Please let me know if there is more info I could provide!


Hi @Bennyhana,

Could you please elaborate it. Provide the expected output also.


Hey thanks for the reply!

So I need the both to choose all the cells under “Client No.” column with the corresponding cell in “Delivery Order” column.

Basically I’m thinking is

  • read cell A2 = N67 > click the button next to Client No. “0001”
  • read cell A3 = N67 > Same as the previous value in cell A2 > click button next to client No. “0002”
  • read cell A4 = N67 > Same step as above
  • read cell A5 = N70 > No longer the same as previous value in cell A4 > proceed to the next step of the process.

Please let me know if this is clear. Thanks!

So the expected output would be clicking the correct Client No. in this list

*expected out would be clicking ALL the correct Client No. in the list

Hi. Instead of checking for changes, you may group your Client No by Delivery Orders.
After grouping you will have a dictionary with key(of string) - (for example) N67 and value (of DataTable) with rows 0001, 0002, 0003.
And than iterate for every keyvalue pair

How to group?
dt.AsEnumerable().GroupBy(Function(row) row.Field(Of String)(“Delivery Order”)).ToDictionary(Function(g) g.Key, Function(g) g.CopyToDataTable)

Have a look in examplesandbox.xlsx (7.9 KB) Main.xaml (8.8 KB)

Awesome! I’m still a beginner with UI path and was not aware of the dictionary functions. This would be really helpful for future projects.

Thank you!

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