Variable - Increment

Declaration

<AMVARIABLE ACTIVITY="increment" RESULTVARIABLE="text" AMOUNT="number" />

Related Topics   

Description

Increments a variable's value by the specified amount. The variable must contain a valid whole 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 activity.

Parameters

General

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.
Increment by Text No 1 AMOUNT="5"

Increases the variable's value by the value entered.

Description

Error Causes

On Error

Additional Notes

Using Variables

All variables must be created before they can be used. This is done using the Create variable activity. Once created, variables can be set using the Set variable activity, 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 (for example, %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

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 increments the specified variable's initial value of 0 by 10 during each loop.

Copy
<AMVARIABLE NAME="thecounter" VALUE="0" />
<AMLOOP FROM="1" TO="10" />
<AMVARIABLE ACTIVITY="increment" RESULTVARIABLE="thecounter" AMOUNT="10" />
<AMSHOWDIALOG WINDOWTITLE="CURRENT VALUE">%thecounter%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />