Variable - Increment

Declaration

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

Related Topics   

Overview

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

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. After they are created, variables can be set using the Set variable activity or by certain actions that support populating variables. To extract data from the variables in any action parameter, enclose the variable name with percent signs (%) (for example, %varname%). Do not use percentage signs when specifying the name of a variable to populate, percent signs are only needed to extract data.

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

The following sample task increments the initial value of the specified variable 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" />