Release 10.1A: OpenEdge Reporting:
Query/Results for Windows

> ## Calculated fields

> So far you have displayed fields that already exist in the database. However, you can create your own column of data, called calculated fields, to help you analyze the information in your query.

> For example, you can create a field called Total Price that automatically multiplies the price of each item a customer orders by the number of items ordered, as shown in Figure 6–3.

> Figure 6–3: Calculated fields example

> Calculated fields are display fields only, so neither the field nor its contents are saved to the database. Table 6–2 shows the types of calculated fields you can create.

> Table 6–2: Calculated fields
> Calculated field types | Description | Availability
> --- | --- | ---
> Percent of total | Expresses the percent of total that the value of a field represents within the query. For example, you can display the percent of total for each sales representative’s monthly sales figures. | Available in the Report and Export views only.
> Running total | Displays the running total of any numeric field or expression. A running total increments for each line of the query. That is, the value displayed in that column on any line in the query is the sum of the field value for that and all previous lines in the query. For example, if the value in the first record is 1 and the value in the second record is 3, the running total for the first line is 1 and the running total for the second record is 4 (1 plus 3). | Available in the Report and Export views only.
> Counter | Displays a running counter. Use counters for line numbering and counting records. | Available in the Report and Export views only.
> Stacked array | Displays the elements in an array in a vertical column. | Available in the Report view only.
> Lookup | Displays the value of a field from a table not included in the query. | Available in all the query views except Labels.
> Math | Defines a math expression based on the value of one or more fields. Use the following operations to calculate the value of the two fields: add, subtract, multiply, divide, or raise to a power. For example, you can create a field named Total Price to multiply the value of the Price and Qty fields for each record in the query. | Available in all views.
> String function | Defines a display field based on a string expression. | Available in all views.
> Numeric function | Defines a display field based on a numeric expression. | Available in all views.
> Date function | Defines a display field based on a date calculation. | Available in all views.
> Logical function | Defines a logical display field based on the value of one or more fields in the query. | Available in all views.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095