Nested while loop


#1

I have tried to create a nested while loop but the execution of only the inner loop is achieved successfully and outer loop counter is completely ignored. Can someone please help?


#3

That’s a for each loop, but the concept would be similar.

@Shatakshi_Mishra can you give us an example of what you’re trying to achieve and we can give specific recommendations?


#4

Hi @Shatakshi_Mishra,
Now you can take the nested While loop.

File : NestedWhileLoop.zip (2.4 KB)

Regards
Balamurugan.S


#5

Hi!
I am trying to understand Uipath better.
I want to read the elements of each cell of an excel and compare them to cells of another excel. So i was trying to use nested while for the same. I tried using ‘read cell’ activity but i wanted to search other options as well.


#6

Hello! Thank you so much for helping!
I tried a similar code but the outer loop’s counter is not getting executed.


#7

first, use two read range activities to get two dataTables, let’s call them dt1 and dt2.
now, create the following structure:

for each row1 in dt 1{
–for each row2 in dt2
----if row1(x)=row2(y) then{
//your things}
} where x and y are the indexes of the columns

when i first started using uipath i’ve used the same technique. although it might not be the best one, it does its job pretty well. please notice that i’ve used row1 and row2 instead of the normal row to avoid confusion and you should do the same if you don’t want unexpected results.


#8

Hi @Shatakshi_Mishra
If you possible can you send me the project file , that to investigate the problem.

Regards
Balamurugan.S


#9

Thank you for the explanation!


#10

excel_1.xlsx (10.7 KB)
Main3.xaml (13.0 KB)
project.json (326 Bytes)


#11

Hi,
Can you check the sample Nested loop application that I have below attached.

NestedLoop.zip (11.1 KB)

Suggestions :
Best to use the For each row activity .

Regards
Balamurugan.S


#12

Can you please send me an example of the same?
Sorry for the inconvenience.!