Troubleshooting
Problem
Web Query has two ways to define a user generated field. This document discusses the difference, provides an example, and references the Web Query RedBook for more information.
Resolving The Problem
Web Query has two ways to define a user generated field. This document discusses the difference, provides an example, and references the Web Query RedBook for more information
IBM DB2 Web Query for IBM i - The Nuts and Bolts (SG24-8379)
There are two types of calculated fields in Db2 Web Query, DEFINE and COMPUTE.
When you use the DEFINE field, you add the definition to the list of fields within the table. This field is calculated every time that a record is read and selected.
When you create a COMPUTE field, the field is not calculated until after the data is sorted and all aggregation is complete.
COMPUTE fields are often required for percentages and variances.
This example shows the difference between Web Query's DEFINE and COMPUTE.

The red arrows show the DEFINE and the blue arrows the COMPUTE.
Notice that for DEFINE, the percent column is merely added together (133.3 + 137.8 + 217.3 = 488.4 (rounding)), generating a percent value that does not make sense. That is because a COMPUTE field is what is required in this example. (3045 / 2160 * 100)
Example of DEFINE

Example of COMPUTE

- make sure your break on Order Number is Recomputed

Any arithmetic calculation that uses an INTEGER for a result data type is truncated and not rounded
Historical Number
N1010784
Was this topic helpful?
Document Information
Modified date:
20 November 2020
UID
nas8N1010784