Adding Computed Fields to a DataWindow Object

You can use computed fields in any band of the DataWindow object.

You can enter any valid DataWindow expression when defining a computed field. You can paste operators, columns, and DataWindow expression functions into the expression in the Modify Expression dialog box. Use the + operator to concatenate strings.

You can use any built-in or user-defined global function in an expression. You cannot use object-level functions.

Note: You are entering a DataWindow expression, not a SQL expression processed by the DBMS, so the expression must follow the rules for DataWindow expressions.
  1. In the Toolbox, select the Compute control.
  2. In the Design view, click where you want to place the computed field.
    For calculations based on column data that changes for each row, place the computed field in the detail band.
    The Modify Expression dialog box lists:
    • DataWindow expression functions you can use in the computed field
    • The columns in the DataWindow object
    • Operators and parentheses
  3. Enter the expression that defines the computed field.
  4. (Optional) Click Verify to test the expression.
  5. Click OK.
To display Enter In this band
Current date at top of each page Today() Header
Current time at top of each page Now() Header
Current page at bottom of each page Page() Footer
Total page count at bottom of each page PageCount() Footer
Concatenation of Fname and Lname columns for each row Fname + " " + Lname Detail
Monthly salary if Salary column contains annual salary Salary / 12 Detail
Four asterisks if the value of the Salary column is greater than $50,000 IF(Salary > 50000, "****", "") Detail
Average salary of all retrieved rows Avg(Salary) Summary
Number of retrieved rows, assuming each row contains a value for EmpID Count(EmpID) Summary

You can refer to other rows in a computed field. This is particularly useful in N-Up DataWindow objects when you want to refer to another row in the detail band. Use this syntax:

ColumnName[x]

where x is an integer. 0 refers to the current row (or first row in the detail band), 1 refers to the next row, -1 refers to the previous row, and so on.

For complete information about the functions you can use in computed fields in the DataWindow painter, see the DataWindow Reference.