The Try Step

What follows is a video describing how to use Try Steps.

Video transcript:

Thank you for using Kapow Katalyst

This tutorial video will guide you through how to use try steps when building robots in Kapow's Design Studio. We'll be using TutorialCase1.robot and TutorialCase2.robot as examples. They can be found in the Tutorials folder of the default project.

TutorialCase1 is a basic robot which extracts data from a table. Once you open TutorialCase1 you will notice that the robot has only one path to follow in the robot view until it reaches this diamond shaped step called a try step. What a try step does is set up multiple alternatives for the robot to try. If an alternative succeeds the robot continues as usual, ignoring any other alternatives from that try step. If an alternative does not succeed the robot goes back to the try step and tries the next alternative.

But what exactly does it mean "to succeed or to not succeed" an alternative?

In TutorialCase1 the first alternative, which is always the topmost one, succeeds in extracting from the age column for each of the three first rows in the table, but for the fourth row there is no age to extract so the extract step encounters an error. The Error Handling of the extract age step is set to "Try Next Alternative". This means that the robot will go back to the try step and try the next branch, which in this case skips the extraction of age and continues to "return object".

TutorialCase2 is a simple robot that fills in a form with input specified by the user. Here the try step is utilized to determine which radio button to select, either male or female, depending on the value of the isMale attribute. To test whether isMale is true a Test Value step has been inserted in the first alternative. If the condition set in Test Value is not satisfied the step then does what is specified in the Error Handling Tab, and as before we set that Error Handling to "Try Next Alternative". By this it follows that if isMale is true the male radio button is selected and the first alternative succeeds, but if the isMale attribute is false the first alternative does not succeed and the second alternative is executed, selecting the female radio button.

Any condition steps, meaning steps with "Test" in their names, work well together with the try step as we just saw.

To summarize, from a try step spring multiple alternative routes for the robot to take. Only the first alternative that succeeds is executed, the others are completely ignored. An alternative succeeds unless it has a step that generates an error and specifies to "Try Next Alternative" in the Error Handling Tab.

Here are a couple of tips when using try steps:

1. If no attempts of a try step succeed then the try step itself generates an error. Specify what action to take in the error handling tab of the try step.

2. You can give a try step a name by double clicking below it in the robot view.

3. When specifying to "try next alternative" under error handling for any step, you can also choose which try step to go back to based on their names. This means you can have nested try steps allowing for complex robot structures.

That concludes this video on the topic of try steps. For more detailed information on try steps and for help in general see the documentation. Also you can check out the KapowSoftware YouTube channel for more tutorial videos.