For each row (continue from break)

Hello ,

I have table where i need to go for each row , but table design is like this:

Headers: at A1 , B1 , C1 …
and than information in : A2,B2,C2,D2,E2 and in F2,F3,F4… and after that next row start from A5
A5,B5,C5,D5,E5 and again F5,F6 … so the first fields are constant i did them with for each row and condition if empty or null continue and it’s working good it’s taking the information but for the last field which is F for each row it’s starting from beginning and it’s not starting from where i used the break activity. I have used Break activity if text is equal to End , and for the first row is good have correct information , but for the second for each it’s getting again information from F2,F3,F4 instead of F5,F6 after last time it breaks when it see End.

Can i make it to continue like first case with each row.

So to take A5,B5,C5,D5,E5 which is doing it , but it’s taking again F2 , F3 , … instead of starting again from F5 , F6 and so on.

Hello @Shwapx!

It seems that you have trouble getting an answer to your question in the first 24 hours.
Let us give you a few hints and helpful links.

First, make sure you browsed through our Forum FAQ Beginner’s Guide. It will teach you what should be included in your topic.

You can check out some of our resources directly, see below:

  1. Always search first. It is the best way to quickly find your answer. Check out the image icon for that.
    Clicking the options button will let you set more specific topic search filters, i.e. only the ones with a solution.

  2. Topic that contains most common solutions with example project files can be found here.

  3. Read our official documentation where you can find a lot of information and instructions about each of our products:

  4. Watch the videos on our official YouTube channel for more visual tutorials.

  5. Meet us and our users on our Community Slack and ask your question there.

Hopefully this will let you easily find the solution/information you need. Once you have it, we would be happy if you could share your findings here and mark it as a solution. This will help other users find it in the future.

Thank you for helping us build our UiPath Community!

Cheers from your friendly


Hey there.

I’m having trouble understanding your problem and how you want to solve this. Can you display (like with an image) an example data within Excel so I can see it more visibly? Also, show what the logic you are currently using like ‘For each row’ and ‘IF’ and where your ‘Break’ is and so on - maybe show an image of your code at that part. Lastly, explain again what you’re wanting it to do exactly.

Typically, you want to keep your logic simple, so you would use one Loop and perform your procedure only within this loop, therefore, you wouldn’t need to re-enter the loop again to continue where it left off.

However, if you do need it to continue where it left off, then you will need to use the Output property of the For Each for the index, and keep that variable global. Then, in your ‘For Each’ use the .Skip() function next to your datatable, so it will jump to the last index.
For each row in dt1.AsEnumerable.Skip(rowIndex) //regulare ‘ForEach’ with TypeArgument as DataRow


Hello thanks for reply here is an example excel file. Basically i have 2 for each row one of them is at start and have if condition.row.isnullorempty continue and it’s working for all of the rows when there is empty , but in the last row i need to type into once place several time for each irritation. There is where i put another for each row and included if condition row.isequal.(“End”) break , but for the next time it start the first for each row it’s typing again the first data in last column and it’s not continuing from last break after “End”

Example.xlsx (10.5 KB)

To better understand what you are trying to do, can you provide before and after of the datatable?. What does it look look before you run process and what should it look like after you loop through.

So it looks like you want to ‘For each row’ with data, store the values under it in ‘Column6’. You could just use a single ForEach for this, but use an IF to do something when ‘Column1’ is empty

For example:

ForEach [row] in [datatable]

      condition: Not String.IsNullOrWhitespace(row("Column1").ToString)
      Assign: column1Value = row("Column1").ToString.Trim
      Assign: column2Value = row("Column2").ToString.Trim
      Assign: column3Value = row("Column3").ToString.Trim
      Assign: column4Value = row("Column4").ToString.Trim
      Assign: column5Value = row("Column5").ToString.Trim
      Assign: column6Value = row("Column6").ToString.Trim
     <do something with values>

           condition: Not row("Column6").ToString.Trim.Equals.ToUpper("END")

              Assign: column6Value = row("Column6").ToString.Trim

              <do something with value>

So, basically, you would just loop over every row, use the IF activity to do something if the value is empty or not.

Let me know if this helps or maybe you want to do something different.
When you try to use a second loop, you would need to use some .net I think to keep it efficient and organized by the row that have values. So, that’s why I thought using 1 loop would be simpler.

Here is better description different colors are different for each row’s and the issue is that let’s say for the first example is working correctly since when sees end it’s breaking , but for the next for each row is taking again first F2,F3 data and it’s not taking the one below keyword “End” for the empty rows i’m just using continue to skip them so next for each to take correct data.Example.xlsx (10.6 KB)

I’m filling form in web and need to take correct row’s just on one of the fields i need to type more than one thing for each row. That’s why there are empty spaces since for column6 i need to type more than one value. And issue is that on the second for each is taking first column6 data and not the one from where break stop it.

Not sure why you are breaking the loop and just not letting it cycle to the next iteration.

I made a correction on my condition to check if it equals ‘End’ to add ‘Not’ infront

Also, I believe you can loop over each row without needing any Break or Continue. Just do something different when the row is empty as shown in my example above

There are 2 for each rows one is the big one for the whole process(cycle) where i’m taking column1-5 data and other for each row is to take data for column6 since for column6 field i need to take more than one row it can be 2-3-4-5 rows data that’s why there is another for each which is looping until it’s meet “End” after that breaks for the first for each , but on the next one is starting from begining for column6 and it’s not continuing from the break point. which is the main issue.


Let’s say it like that all different colors are different products and data is typed in different fields , for the first fields there is no issue the problem is when it goes to column6 if i use only 1 for each it’s taking only the first data if i use another for each for column6 i need to break it so it will stop typing data. And for the next product it’s taking again from the beginning column6 not from “End” point.

oops. It should be .ToString.Trim.ToUpper.Equals("End")

I’m looping for each row ,

A2,B2,C2,D2,E2, and for Column F i want to type into not only F2 , but type F2,F3 when it reach End break and on next “product”(for each)

go for A5,B5,C5,D5,E5 and for Column F start after “End” F5,F6,F7 when reach End break again. and same thing for other’s.

It should still work as you want with 1 ForEach. You just need to click and type into on the row based on if it’s empty or not.

So, you can do that inside the If activity that checks if column1 is empty. In the Then/True side, do what you want to do when the row is empty, then in the Else side, do something different. (or viceversa if you use ‘Not’ in the condition)

Thanks to @ClaytonM now the irritation is working as intended.

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