Loop - Break |
Declaration
<AMBREAK />
Description
Breaks out of a Loop or If statement.
Practical Usage
Can be used inside a Loop activity to break out of the loop if a particular condition takes place.
Parameters
There are no parameters for this activity.
Example
NOTE:
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
This sample task loops 6 times and examines the current value to see if it is greater than or equal to 3 during each iteration. If the value is greater than or equal to 3, the task breaks out of the loop using the Break action.
Copy
<AMVARIABLE NAME="indexvar" VALUE="" />
<AMLOOP TOTALLOOPS="6" RESULTVARIABLE="indexvar"><AMSHOWDIALOG>%indexvar%</AMSHOWDIALOG><AMIF EXPRESSION="%indexvar% >= 3"><AMBREAK /></AMIF></AMLOOP>
<AMSHOWDIALOG>%indexvar%</AMSHOWDIALOG>
<AMIF EXPRESSION="%indexvar% >= 3" USECOMPLEXUI="YES" />
<AMBREAK />
<AMIF ACTIVITY="end" />
<AMLOOP ACTIVITY="end" />