Consultor Eletrônico



Kbase P19885: ACCUM MAXIMUM and MINIMUM return 0 when there are no records
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/6/2003
Status: Unverified

FACT(s) (Environment):

Progress 9.0x

FACT(s) (Environment):

Progress 9.1A

FACT(s) (Environment):

Progress 9.1B

FACT(s) (Environment):

Progress 9.1C

SYMPTOM(s):

ACCUM MAXIMUM and MINIMUM return 0 when there are no records in the ACCUMULATE iteration block

CAUSE:

This seems to be a bug of 9.0A to 9.1C fixed in 9.1D . However there is no bug entry for this. Probably this fix has been consequent to some other bug fix that also involve the ACCUMULATE statement.

CAUSE:

The exact cause is unknown at the time of this writing.

FIX:

Upgrade to version 9.1D or evaluate the MINIMUM, MAXIMUM by using the following  4GL code:

/* this use sports2000 DB */

DEFINE VARIABLE myMinimum AS DECIMAL INITIAL ?  NO-UNDO.
DEFINE VARIABLE myMaximum AS DECIMAL INITIAL ?  NO-UNDO.

FOR EACH Invoice NO-LOCK:
    ACCUMULATE Invoice.Amount (AVERAGE COUNT MAXIMUM MINIMUM TOTAL).
    IF (myMinimum = ?) THEN myMinimum = Amount.
    IF (myMaximum = ?) THEN myMaximum = Amount.

    IF Amount < myMinimum THEN myMinimum = Amount.
    IF Amount > myMaximum THEN myMaximum = Amount.

END.