A variety of temporary fields can be created from existing fields in the database by using the COMPUTE and DEFINE commands. Both methods calculate the temporary fields after records are selected per the screening criteria. The major difference between COMPUTE and DEFINE is the point of calculation.
Computed fields are calculated on the results of a display command after the selected records have been sorted and summed.
For example:
EX AC
TABLE FILE AC
PRINT AC:CLASS AC:BASEPAY
AND COMPUTE NEWSAL = AC:BASEPAY * 1.03;
BY AC:WNAME
IF AC:CBID EQ R03
END
Defined fields are calculated on the selected records before the sorts and display commands are applied.
For example:
EX AC
DEFINE FILE AC ADD
NEWSAL = AC:BASEPAY * 1.03;
END
TABLE FILE AC
PRINT AC:CLASS AC:BASEPAY NEWSAL
BY AC:WNAME
IF AC:CBID EQ R03
END
Related Topic: How FOCUS Processes A Report Request and Generating A Running Total
Last Updated: February 22, 2024