let mytotals[i:=i+1]=mytotals + someNotNullValueFromDb ...
FOREACH ... INTO curr_value LET mytotals[i:=i+1] = 0 LET mytotals[i] = <whatever> + NVL(curr_value,0)END FOREACH
MAIN DEFINE rec RECORD field1 INTEGER, field2 STRING, field3 DATEEND RECORD OPEN WINDOW w WITH FORM base.Application.getProgramName() INPUT BY NAME rec.* ATTRIBUTES(WITHOUT DEFAULTS=TRUE, UNBUFFERED)END MAIN
MAIN DEFINE arr DYNAMIC ARRAY OF RECORD field1 INTEGER, field2 STRING, field3 DATEEND RECORD OPEN WINDOW w WITH FORM base.Application.getProgramName() INPUT ARRAY arr FROM scr.* ATTRIBUTES(WITHOUT DEFAULTS=TRUE, UNBUFFERED)END MAIN
MAINDEFINE arr DYNAMIC ARRAY OF INTEGERDEFINE i INTEGERCONSTANT MAX_SIZE = 100000000 LET arr[MAX_SIZE] = 0 --FOR i = 1 TO MAX_SIZE -- LET arr[i] = 0 --END FOR MENU "" ON ACTION ACCEPT EXIT MENU END MENUEND MAIN
MAIN DEFINE s CHAR(40) DEFINE fixarr array[1] OF RECORD i INTEGER ,s CHAR(20) ,f DECIMAL(10,2) ,d date END RECORD DEFINE dynarr DYNAMIC array OF RECORD i INTEGER ,s CHAR(20) ,f DECIMAL(10,2) ,d date END RECORD DISPLAY 'fixed array ....' LET s =MYisNull(fixarr[1].i) DISPLAY ' fixarr[1].i : ',s CLIPPED LET s =MYisNull(fixarr[1].s) DISPLAY ' fixarr[1].s : ',s CLIPPED LET s =MYisNull(fixarr[1].f) DISPLAY ' fixarr[1].f : ',s CLIPPED LET s =MYisNull(fixarr[1].d) DISPLAY ' fixarr[1].d : ',s CLIPPED ALLOCATE ARRAY dynarr[1] DISPLAY 'dynamic array ....' LET s =MYisNull(dynarr[1].i) DISPLAY ' dynarr[1].i : ',s CLIPPED LET s =MYisNull(dynarr[1].s) DISPLAY ' dynarr[1].s : ',s CLIPPED LET s =MYisNull(dynarr[1].f) DISPLAY ' dynarr[1].f : ',s CLIPPED LET s =MYisNull(dynarr[1].d) DISPLAY ' dynarr[1].d : ',s CLIPPEDEND MAIN FUNCTION MYisNull(f) DEFINE f char(40) IF f IS NULL THEN RETURN "NULL" END IF RETURN f END FUNCTION