Increment Variable Action

Declaration

<AMINCREMENTVARIABLE RESULTVARIABLE="text [variable name]" AMOUNT="number">

 

See Also

Delete AD Object-Setting Properties, Create AD Object Action, Create AD User Action, Create AD Group Action

<AMINCREMENTVARIABLE RESULTVARIABLE="text [variable name]" AMOUNT="number">

Description

Increments a variable by the specified amount.  The variable must contain a valid number.  If the variable is blank, zero is assumed.

Practical Usage

Used to increase the value of a "counter" variable. Normally counters are used inside of a loop.

Parameters

General Tab

Variable to increment

Text [variable name], Required
MARKUP: RESULTVARIABLE="thecurrentdate"

Specifies the name of the variable to increment.

Amount

Number, Optional - Default is 1
MARKUP: AMOUNT="5"

Specifies the value that the variable should be incremented (increased) by.

Notes

Using Variables

All variables must be created before they can be used. This is done using the Create Variable <AMVARIABLE> action. Once created, variables can be set using the Set Variable <AMSET> 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.

Custom Description

This action includes the Description tab for entering a custom step description.

More on setting custom step description

Standard Error Handling Options

This action also includes the standard Error Causes and On Error failure handling options/tabs.

More on Error Handling Options

Variables and Expressions

All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane of the Task Builder.

<AMVARIABLE NAME="thecounter">0</AMVARIABLE>
<AMLOOP TOTALLOOPS="100">
<AMINCREMENTVARIABLE RESULTVARIABLE="thecounter">
</AMLOOP>