Using the SET and CALCULATE action commands
Using the SET and CALCULATE action statements the value of the data item referenced
as Value 1 is updated, overwriting any current value.
Therefore, when you are using these commands you must be very careful that you do not update original data entry values in error.
You must use work space areas to store the data values.
Consider the following separate examples:
Command | Value 1 | Operator | Value 2 | Result |
SET | Amount Work Space 1 | = | Base amount | The base amount is stored in amount work space 1. |
CALCULATE | Amount Work Space 1 | * | 0.2 | 20% of the base amount is calculated and stored in amount work space 1. |
CALCULATE | Transaction Amount | * | 1.1 | The transaction amount is increased by 10% and the original transaction amount is lost! |