Variable - Decrement

Declaration

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

Description:

Decrements the value of a variable by the specified amount. The variable must contain a valid number. If the variable's initial value is blank, zero is the number assumed.

Practical Usage

Used to decrease the value of a "counter" variable. Normally, counters are used inside of a loop. To increment a variable's value, use the Increment variable activity.

Parameters

General

Property

Type

Required

Default

Markup

Description

Variable to decrement

Text

Yes

(Empty)

RESULTVARIABLE="theNumber"

The name of the variable containing the value to decrement. The variable must contain a valid number. If the variable's initial value is blank, zero is the number assumed.

Amount

Text

No

1

AMOUNT="5"

The value that the variable's value should be decreased by.

 

Description

Error Causes

On Error

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 (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

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

Description: This task decrements the specified variable's initial value of 100 by 20 during each loop.

 

<AMVARIABLE NAME="thecounter">100</AMVARIABLE>

<AMLOOP TOTALLOOPS="5">

     <AMDECREMENTVARIABLE RESULTVARIABLE="thecounter" AMOUNT="20" />

     <AMSHOWDIALOG WINDOWTITLE="CURRENT VALUE">%thecounter%</AMSHOWDIALOG>

</AMLOOP>