GoTo Statement of Skip Statement

  • 15 December 2022
  • 4 replies
  • 68 views

Userlevel 2
Badge +4

Hello-

 

I have this scenario:

 

I have one mainBot with 3 subBots.  In the subBots I pass an Employee ID from the mainBot to the subBots. Each bot is responsible for checking one system for information.  If there is information in any one of these systems then it will trigger a boolean flag that means that I will then need to do or more substantial check.  Is there a way to do this more efficiently then just using an if statement?  Essentially I am looping through three bots…. If a flag equals true then exit and go to another subBot that does the more substantial check.

 

i.e. Here are two scenarios:

 

Scenario 1:

subBotA runs there is info found which triggers flag to TRUE

subBotB is now skipped

subBotC is now Skipped

subBotX (substantial check) is now run

 

 

Scenario 2:

subBotA runs there is no info found so the flag is FALSE

subBotB runs there is info found which triggers flag to TRUE

subBotC is now Skipped

subBotX (substantial check) is now run

 

 

i.e. I want the Flag being TRUE to trigger the event to go to the substantial check…..

 

 

This is the way I was thinking I would have to do it unless there is a better alternative (Using IF statements)?

 

subBotA runs an returns the Flag value

mainBot runs an if statement to check if the Flag is TRUE if TRUE

          Run subBotX substantial bot

ELSE

           Run subBotB and then a flag is returned

mainBot runs an if statement to check if the Flag is TRUE if TRUE

          Run subBotX substantial bot

ELSE Run subBotC

mainBot runs an if statement to check if the Flag is TRUE if TRUE

if TRUE Run subBotX substantial bot

If FALSE exit the bot procedure…..

 

Any help or insight would be very much appreciated!  Thank you again!

 

Ideally, I think I would run all these subBots asynchronously and then evaluate the flag in one step….. 

 

 

 

 


4 replies

Userlevel 3
Badge +6

Dear @Matt 7768,

 

One way to do this more efficiently is to use a loop construct in your mainBot that iterates through the subBots and checks the flag in each subBot. If the flag is true in any of the subBots, you can exit the loop and move on to the next step in your mainBot.

 

Regards,

Userlevel 7
Badge +13

Hi @Matt 7768 ,

 

In addition to what @Zaibi mentioned above, you can use the Loop-While functionality and put the required condition to satisfy. Based on the condition, it will either loop through or skip the loop and move on to the next action.

 

Hope this will help.

Userlevel 2
Badge +4

@Zaibi @Padmakumar 

 

Thanks so much for the help.  The Loop-While sounds perfect.  Not sure how I overlooked that.

Userlevel 5
Badge +10

@Matt 7768 : i used same framework and i used to use property file/ execution file to store the flag value after each sub process. So, if bot fails, i used to use this file to restart the subprocess where it failed...

Reply