Using Temporary Fields

Topics:

Sometimes the information you want to use is not stored in the data source, but you can calculate it from data that is. For example, you might want to use employee salaries and deductions to calculate their net take-home pay. If you can compute the data you want, then you can create a temporary field to calculate and display it.

There are two ways to create a temporary field. You can define it in the report request using the COMPUTE command (calculated value), or you can declare it before you write the report request using a DEFINE command (virtual field).

The main difference between fields created with COMPUTE and fields created with DEFINE is that DEFINE creates the fields before you start the report request and COMPUTE creates the fields after records have been retrieved. Once the DEFINE command has been executed, the temporary fields look just like real fields from the data source. You can use them to sort the report, select records, or use them in other temporary field definitions.

WebFOCUS

Feedback