How to break inner foreach loop?

How to break inner foreach loop?

  
Hi everyone,

I tried to break the loop using end node as shown in the below figure


After execution of end node in a for each loop it is not going to the outer loop. It is treating the end node in loop as final end, please help me where am I doing wrong?
Hi Sallini , 

1.Connect Second loop to test assignmnet  right now which is connected to data assignement.
2connect test to data which is connect to end action here.

Because of ur end action ur not able to execute sencond loop.
please let me know its working or not..
Hi Anju,

If I connect the second for loop's connector to test assignment then after completion of the second for each loop iteration it will execute the test assignment which should not happen.


why do you need to break the loop?

sugestions:
- you can just continue the loop, just set a flag to false or so?
- don't make a innerloop, juts a counter that incements and an if-statement  (the old school goto-variant)

Hi Salini,

try to encapsulate the inner foreach in another action. When the loop breaks, the action will step-out to the parent foreach and this loop will continue. 

Cheers,
Hi Andre,

Thanks a lot for the solution. It worked for me. :)

André Siébra wrote:
Hi Salini,

try to encapsulate the inner foreach in another action. When the loop breaks, the action will step-out to the parent foreach and this loop will continue. 

Cheers,
 
 
Hi J,

Thank you for your suggestion.

My requirement is something like below
There are 5 tables with structure as below , 
Table Name            Columns
---------------             ---------------
Table1                     Table1id, Name ,…….
Table2                      Table2id, Name, ……………
Table3                      Table3id, Table1id, Table2id, ….
Table4                      Table4id, Name, ………….
Table5                      Table5id, Table3id, Table4id, sampleCol, …
 
Now I need to display a table in which the column headers are rows from table4 and column data comes from table5 “sampleCol”.
 
Assuming the data in tables as below
Table4
--------
1                     Test1
2                     Test2
3                     Test3
 
Table5
---------
1              1              1              Sample1
2              1              2              Sample2
3              2              1              Sample3
4              2              2              Sample4
5              2              3              Sample5
 
Now I need to display something like this
 
Test1                     Test2                     Test3
Sample1                Sample2                --
Sample3                Sample4                Sample5               
 
To achieve this, what I am doing is creating an html table dynamically and assigning it to expression.
To create the html, I am getting “Table4” records and forming the header first, and later to form the data I am looping through the “Table4”(Outer loop) data and “Table5”(inner loop) data.


Is this the correct way or any other better way is possible?



J. wrote:
why do you need to break the loop?

sugestions:
- you can just continue the loop, just set a flag to false or so?
- don't make a innerloop, juts a counter that incements and an if-statement  (the old school goto-variant)
 
 
 
well, it really depends how you want to show the data.

you could go for the ul-variant, so only 1 query,for-loop is needed.