Result
Mandatory.
Specify the result virtual field or a *WORKnnnnn field that will be used in a mathematical expression of:
Factor1 (Operator) Factor2 = Result
Rules
- The final result in the calculation must be the defined virtual field.
Tips & Techniques
- The *WORKnnnnn fields are exclusively reserved for use in "virtual" code extended definition "mathematical calculations" only.
- The *WORKnnnnn fields do not have to be defined within LANSA, the *WORKnnnnn field length will be automatically assumed to 30, 9 if the machine is an IBM i.
- All *WORKnnnnn fields that are used in a mathematical calculation are automatically initialized before the first time they are used.
- Multiple *WORKnnnnn fields can be used in mathematical calculations simply by replacing the nnnnn portion of the work field name with a unique replacement value.
- If *WORKnnnnn fields with the same name are used in other virtual fields' mathematical calculations, their values will not be carried forward to the next virtual field's mathematical calculation.
Platform Considerations
- IBM i: The *WORKnnnnn fields do not have to be defined within LANSA, the *WORKnnnnn field length will be automatically assumed to 30, 9 if the machine is an IBM i.
- Other platforms: Virtual field calculations support a maximum of 15 digits precision. This means that if the contents of the field in Factor 1, Factor 2 are more than 15 digits, or the result would exceed 15 digits, this will result in an error and/or an incorrect result. To avoid this, if the file is RDMLX, use an RDMLX code fragment. If the file is RDML, use a trigger function to calculate the result field. RDML mathematics will work correctly in a trigger function on all platforms.
Also See