Syntax
MODIFY:u=w|x|y|PRIORITY=z
u is the variable namespace (must have been defined by a NAMESPACEDEF)
w is the variable name as defined in the Variable LST file
x is the modification type. Legal types FOR NUMBER are shown below... The legal types will be different based on the format of the variable
y is the modification (based on the type, see below)
z is an OPTIONAL priority. If not specified, it is assumed to be zero.
Priority
Items are processed in a Natural Priority order. PRIORITY is used to order any modifiers, then a natural ordering is used. So when:
MODIFY:Var|ADD|4
MODIFY:Var|MULTIPLY|5
are applied, the Multiplication will ALWAYS occur first, regardless of token order in the file. If you are unsure of natural order, use PRIORITY to control processing order.
Priority must be >= 0
Items are processed from the lowest priority to the highest (highest is applied last, so a SET with a high priority is applied last)
A clarification on natural ordering: it does NOT replace priority if not defined. The two priority comparisons (user priority and natural priority) are independent. So an item of user priority 1 and natural priority 3 will be processed before user priority 2 and natural priority 2, solely based on the user priority)
Legal Types for variables that are NUMBER format
ADD
ADD takes a Numeric Argument.
Equations using other variables are allowed, but direct values will be faster.
The 'natural' priority is 3.
MULTIPLY
MULTIPLY takes a Numeric Argument.
Equations using other variables are allowed, but direct values will be faster.
The 'natural' priority is 2.
MAX
MAX takes a Numeric Argument.
Equations using other variables are allowed, but direct values will be faster.
This sets an upper bound on the value (a maximum that the value can be)
The 'natural' priority is 4.
MIN
MIN takes a Numeric Argument.
Equations using other variables are allowed, but direct values will be faster.
This sets a lower bound on the value (a minimum that the value can be)
The 'natural' priority is 5.
SET
SET takes a Numeric Argument.
Equations using other variables are allowed, but direct values will be faster.
This sets the value (any previous value is overwritten/ignored)
The 'natural' priority is 0.
If you have a value that was previously modified from the default (or you want to enable that based on using a higher PRIORITY= then you should use the value() function to capture the existing value. Thus the following are equivalent:
MODIFY:Foo|ADD|4
MODIFY:Foo|SET|value()+4
Note that the ADD is preferred because it is smaller in memory and faster to process, but more complex calculations will obviously require a formula as the argument
Note that MODIFY does NOT work in Campaign (PCC) files. A Global Modifier file should be used instead.
PR#960