Can't stop the loop after it has read the last data

I am using a for each activity.
It is reading each bill no. that is there in the datatable.
The problem is that after it has read the last bill no. it is not coming out of the loop and again tries to find a bill no. and hence giving an error.
what shall i do?

1 Like

@diptojyotidutta Can you share the screen shot of the loop which you are using.

the loop is very lengthy
so i am just sending you the very first part of the loop.
selectno is the place where it is showing error after it has stored all the data regarding a bill no in the database.

how shall i exit the loop.
As it is again trying to find the bill no. after it has read and stored the last bill no data to the database

@diptojyotidutta If you are using for each row means it needs to exit.

This is the problem. it is not happening.
And i don’t understand why

Hi @diptojyotidutta
Can you share your xaml to easily address the issue.

Happy learning

1 Like

@diptojyotidutta Do one thing check how many rows are there in the datatable to check use datatable.Rows.Count

Main.xaml (125.6 KB)
here it is

okay @indra But what should i do after that?

Any suggestions friends?


Could you share error screenshot to find the problem

@diptojyotidutta xaml looks fine but not able to run the xaml to track the exception.

Here it is @amaresan

ok @indra thanks for your help


try below xaml and let me know if you are facing any other issue

Main (2).xaml (137.2 KB)

@diptojyotidutta while using read range, rather than reading entire table specify the range specifically upto where you want read, so that it comes out of loop once it completes all the rows

Hi Amaresan,

Thanks for the updated file.

I am new to the field and trying the updated file where am facing errors as below.

It says,“The document has unresolved acitivities. You will not be able to save it until it is resolved. Also, the output panel shows the errors activities in RED”.

Sorry, if my question is being silly. Just trying to understand.

Many thanks in advance!


Please install Database package in manage package.

1 Like

@venkatmalla6 I am not using any read range activity. I am using a datatable output