Decrement Variable

Decrements a variable by the specified amount. The variable must contain a valid number. If the variable is blank, zero is the number assumed. Used to decrease the value of a "counter" variable. Normally, counters are used inside of a loop.

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, surround the variable name with percentage % signs (i.e. %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.

To enter Decrement Variable properties

  1. In the Available Actions pane, open the Variables folder and double-click the Decrement Variable action or drag it into the Steps pane.

  2. In the Variable Name box, select the variable to increment.

  3. In the Decrement by box, enter the amount by which to decrease the variable. If the variable is blank when the decrement step runs, zero value is assumed. If you want to use an expression, click the percent sign (%) and use the Expression Builder to create it.

  4. To set the Description tab properties, refer to Description Tab Options.

  5. To set the Error Causes and On Error tab properties, refer to Step Error Handling.

  6. When finished, click OK to save settings and close the properties dialog box.

Declaration

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

Example

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>

See Also: Create Array, Create Object, Create Variable, Decrement Variable, Define Type, Increment Variable, ReDim Array, Set Variable

General Tab

Property

Type

Required

Default

Markup

Description

Variable to decrement

Text

Yes

(Empty)

RESULTVARIABLE="thecurrentdate"

The name of the variable to decrement.

Amount

Text

No

1

AMOUNT="5"

The value that the variable should be decreased by.