This function allows you to perform some basic numerical operations
on variables.
Overview
Operation
Description
Increment value
Increments the variable value by 1. This operation
is typically used to accommodate for reiteration within a loop (e.g. as
a result of a goto label). Similarly, you could cycle through the rows
of a table and use this script action to increment the row counter.
Decrement value
Decreases the variable value by 1. This operation
is typically used to accommodate for reiteration within a loop (e.g. as
a result of a goto label). Similarly, you could cycle through the rows
of a table and use this script action to decrement the row counter.
Add number
Adds a number to an existing numeric variable.
The number to add can be held by a variable.
Subtract number
Subtracts a number from an existing numeric
variable. The number to subtract can be held by a variable.
Multiply by
Multiplies an existing numeric variable by
a number. The number to multiply with can be held by a variable.
Divide by
Divides an existing numeric variable by a
number. The number to divide with can be held by a variable.
Convert from variable
Converts an existing text variable to a numeric
variable. The variable to convert needs to be selected in the "Source
variable" list box. The name of the new numeric variable needs to
be specified in the Numeric variable field.
Cycling through
the records in a table using Increment / Decrement value
To do this, you would need to define the following:
Set a row counter variable (e.g. %RowCounter%)
to 0 using the Set variables action item
Retrieve the number of rows in a column and assign
these to a variable (e.g. %NumberOfRows%) using the option "Get number
of rows" in the Manage table data
script action
Create a loop which includes:
- an If-Then-Else statement (IF the value
of %RowCounter% is smaller than %NumberOfRows%, THEN execute a script,
ELSE do something else)
- the action to execute when the IF statement
returns TRUE
- Update numeric variable action to increment
the value of %RowCounter% by 1. This will let you cycle to the next row
in the table.
- GoTo statement to return to the If-Then-Else script action to evaluate
the next row in the table
-"No operation" script action
as an ELSE clause (IF statement returns FALSE)