Warning if do while is in an endless loop

Hello together,

I need some help with my “do while”-Activity.
In my process the bot starts a report in SAP. Because it is possible that SAP open an extra-Window with a warning inside while loading the report I built a ‘do while’ with an try catch to click the continue button until the report is ready (check if a new SAP-page without a specific icon on it is open) to continue with the rest of the process. It works fine!
But now I need a warning (per mail or something else) if the loop is due to an unknown error in an real endless loop.
Is there a way to build in a warning when this loop through the report takes longer than 2 hours?
image

1 Like

Hey @thomas.seeber

You can use retry scope for the same

Thanks
#nK

Hello @thomas.seeber,

If I understood correctly, sometimes the do while is giving you an unknonw error and you need to be sent an email of this unknown error?

If so, put the do while inside a try catch, and get the error in catch, and put an email activity with the error message :slight_smile:

If you do nothing, does the Continue button disappear when the report is ready? If so, you should watch for the button (or something else) to disappear. Or you could wait for something on the screen to appear - whatever appears when the report is ready.

Then everything depends upon the timeout of the Check App State activity, and it’ll throw an error if the timeout expires.

Hi Thomas,

I think you have a few ideas and thoughts, hoping I grasp your question correctly.

Your Try-Catch only works if an error occurs, since you’re stuck in an infinite loop, it never errors out.

I am thinking you may need a Parallel activity, that allow you to look for different screen activity at the same time. You can even set it so that one of the parallel activities generates a throw, invoking the Catch part of your Try-Catch. By defining the error type you can customize your error message that you can incorporate into an email alert.

You can also use the loop to check for something that doesn’t exist while report is running but does exist when it’s done. than add a count for each loop. If you want it to check every minute (use Delay activity to time it approximately right, or the Target.Timeout to 60000 functionality.) if total count > 120, set loop boolean to stop to True and you are not interrupting the otherwise infinite loop. Include that if count > 120, do a Throw Activity, so you’re using the Catch to send the message you mentioned.

I think the Parallel activity may be your friend.

Parallel doesn’t actually run the activities inside it in parallel. They’re still executed in order. It’s just that the automation doesn’t continue to the next activity until all sections of Parallel have completed.

Thanks, Paul. I never experienced it like that. Appreciate the correction!

@jeronk I tried your way, but have two problems:

I have used a Parallel-Activity. On the Left is a Do While to close an extra window which can appear one ore more times during the report
On the right is a Do While to check the time the report runs. When it needs more than x minutes it should throw out an error (BusinessRuleException).
The whole parallel is put in a TryCatch to bring a Message Box then the error is occured
image



image

Problem 1 = The Error was thrown after the first Appearing of the window I have to close and not after the time I want. The Process should throw the error e.g. 5 minutes after starting report, no matter the report is ready or not or if there is a window to close

Problem 2 = I get the error:
image instead of the Message box I want. Where is my mistake?

Do you have any idea please?

Parallel doesn’t do what people think it does. Read my earlier reply.

Yes I understand, but is wrong here?

My message box appears every time when the report finished in the timerange I cheked. In this case the bot should continue with the process and not bring the message box.

I am end of ideas :frowning:


This is because, as explained earlier, Parallel doesn’t actually run its activities in parallel. It still runs them sequentially.

found a solution without parallel activity

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