Variable - Increment
Declaration
<AMVARIABLE ACTIVITY="increment" RESULTVARIABLE="text" AMOUNT="number" />
Description: Increments a variable's value by the specified amount. The variable must contain a valid number. If the variable's initial value is blank, zero is assumed.
Practical Usage
Used to increase the value of a "counter" variable. Normally, counters are used inside of a loop. To decrease a variable's value, use the Decrement variable activity.
General Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Variable to increment |
Text |
Yes |
(Empty) |
RESULTVARIABLE="thecurrentdate" |
The name of the variable that contains the value to increment. The variable must contain a valid number. If the variable's initial value is blank, zero is assumed. |
Amount |
Text |
No |
1 |
AMOUNT="5" |
The value that the variable should be increased by. |
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.)
Using Variables
All variables must be created before they can be used. This is done using the Create Variable action. Once created, variables can be set using the Set Variable action, or by certain actions that support populating variables. To get data out of the variables in any action parameter, simply surround the variable name with percentage % signs (e.g., %varname%). Remember not to use percentage signs when specifying the name of a variable to populate, percentage signs are only needed to get data out.
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description:This sample task Increments the specified variable's initial value of 0 by 10 during each loop.
<AMVARIABLE NAME="thecounter">0</AMVARIABLE> <AMLOOP TOTALLOOPS="10"><AMINCREMENTVARIABLE RESULTVARIABLE="thecounter" AMOUNT="10" /> <AMSHOWDIALOG WINDOWTITLE="CURRENT VALUE"> Current Value is %thecounter%. </AMSHOWDIALOG> </AMLOOP>