Label - Goto
Declaration
<AMLABEL LABELNAME="text" />
Description: Sends task flow to the label indicated.
Practical Usage
Used to direct the task to jump to a labelled section defined by the Label action. Make the Goto dependent on an If action or some other condition to avoid an endless loop between Goto and the label.
IMPORTANT: Excessive use of Goto can create tasks that are difficult or impossible to debug. If your task requires more than a few Goto steps it is recommended to consider re-structuring with sub-tasks (using the Start task activity). In many programming languages, the use of even one Goto statement is considered bad programming practice. Use at your own risk!
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Label to Goto |
Text
|
Yes
|
(Empty)
|
LABEL="bugHandler" |
The name of a pre-existing label in the task in which to jump to. To create a label in a task, use the Label Action. |
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description; This sample task checks if "C:\Temp\test1.txt" exists. If so, it will be copied to "C:\Monthly_Backup\Archive\test1.txt" and a subsequent step stops the task. If not, the task will skip to a label named "bugHandler", at which point, a subsequent step will display a message dialog stating "File not found."
<AMIF ACTIVITY="file_exist" FILE="C:\Temp\test1.txt" MODE="not_exist"> <AMGOTO LABELNAME="bugHandler" /> </AMIF> <AMFILECOPY SOURCE="C:\Temp\test1.txt" DEST="C:\Monthly_Backup\Archive\test.txt"/> <AMSTOPTASK STATUSTYPE="SUCCESS" /> <AMLABEL LABELNAME="bugHandler" /> <AMMESSAGEBOX>File not found!</AMMESSAGEBOX>