HP 3000 Manuals

Aggregate/Array Operations [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation


HP ALLBASE/BRW Reference Manual

Aggregate/Array Operations 

HP ALLBASE/BRW includes many aggregate/array operations that act on
arrays.  One example is an operation that sums all the values of an
array.

Aggregate/array operations are calculations very similar to column
calculations except that they affect array items.

HP ALLBASE/BRW includes the following aggregate operations:

------------------------------------------------------------------------------------------
|                                                                                        |
|         Function                                   Definition                          |
|                                                                                        |
------------------------------------------------------------------------------------------
|                                                                                        |
| SUM                       Accumulates the values                                       |
|                                                                                        |
| AVG                       Calculates the average of the values                         |
|                                                                                        |
| MIN                       Gives the minimum value                                      |
|                                                                                        |
| MAX                       Gives the maximum value                                      |
|                                                                                        |
| INDEX_MIN                 Gives the index of the minimum value                         |
|                                                                                        |
| INDEX_MAX                 Gives the index of the maximum value                         |
|                                                                                        |
| COUNT                     Counts the values; ignores NO_VALUE                          |
|                                                                                        |
------------------------------------------------------------------------------------------

A typical example of the use of an aggregate operation is the creation of
cumulative values, shown here:

     SUM i = 1 TO 12 OF customers.turnover (i)

where i is the aggregate index, 1 the start index, 12 the stop index, and
customers.turnover (i) is the aggregate expression, and in this case, an
array item.

In this next example, the customer's turnover values are accumulated from
January up to the month specified by the parameter ?month.  The start
index, stop index and the aggregate expression can be any numeric
expressions.

      SUM i = 1 TO !!?month!! OF  TURNOVER(i)



MPE/iX 5.0 Documentation