Here is where I got the references I use in 9.05. Hopefully it will apply to 8.03. I mainly use the ABL Reference and ABL Essentials. Below is from the reference on using ACCUM. The formatting got lost from the PDF, but the PDF is here.
ABL Reference:
http://documentation.progress.com/output/OpenEdge102b/pdfs/dvref/dvref.pdf
All OE documentation:
https://community.progress.com/community_groups/openedge_general/w/openedgegeneral/1164.openedge-10-2b-product-documentation
ACCUM function
Returns the value of an aggregate expression that is calculated by an ACCUMULATE or
aggregate phrase of a DISPLAY statement.
Syntax
aggregate-phrase
A phrase that identifies the aggregate value it should return. This is the syntax for
aggregate-phrase:
For more information on aggregate items, see the Aggregate phrase reference entry.
expression
An expression that was used in an earlier ACCUMULATE or DISPLAY statement. The
expression you use in the ACCUMULATE or DISPLAY statement and the expression you
use in the ACCUM function must be in exactly the same form. (For example, “on-hand *
cost†and “cost * on-hand†are not in exactly the same form.) For the AVERAGE,
SUB-AVERAGE, TOTAL, and SUB-TOTAL aggregate phrases, expression must be
numeric.
Example This procedure shows a total for the extended price of each item on an order. The running total
of the order is displayed as well as the order total and grand total for all orders. This procedure
accumulates totals at three levels.
r-abs.p
DEFINE VARIABLE mark-start AS DECIMAL NO-UNDO.
DEFINE VARIABLE mark-finish AS DECIMAL NO-UNDO.
DEFINE VARIABLE units AS LOGICAL NO-UNDO FORMAT "miles/kilometers".
FORM
mark-start LABEL "Mile marker for highway on-ramp" SKIP
mark-finish LABEL "Mile marker next to your exit" SKIP(1)
units LABEL "Measure in <m>iles or <k>ilometers" SKIP(1)
WITH FRAME question SIDE-LABELS
TITLE "This program calculates distance driven.".
UPDATE mark-start mark-finish units WITH FRAME question.
DISPLAY
"You have driven" ABSOLUTE(mark-start - mark-finish) units
WITH NO-LABELS FRAME answer.
ACCUM aggregate-phrase expression
Syntax
{ AVERAGE | COUNT | MAXIMUM | MINIMUM | TOTAL | SUB-AVERAGE | SUB-COUNT
| SUB-MAXIMUM | SUB-MINIMUM | SUB-TOTAL } [ BY break-group ]
ACCUMULATE statement
34
See also ACCUMULATE statement, DISPLAY statement
ACCUMULATE statement
Calculates one or more aggregate values of an expression during the iterations of a block. Use
the ACCUM function to access the result of this accumulation.
Syntax
expression
An expression for which you want to calculate the aggregate value. The expression you
use in the ACCUMULATE statement and the expression you use in the ACCUM function
(when using the result of the ACCUMULATE statement) must be in exactly the same
form. (For example, “A * B†and “B * A†are not in exactly the same form.)
aggregate-phrase
Identifies one or more values to calculate based on a change in expression or a break
group. This is the syntax for aggregate-phrase:
For more information, see the Aggregate phrase reference entry.
Examples This procedure calculates and displays statistics for all customers, but does not show the detail
for each customer.
r-accum.p
FOR EACH Order NO-LOCK:
DISPLAY Order.OrderNum Order.CustNum Order.OrderDate Order.PromiseDate
Order.ShipDate.
FOR EACH OrderLine OF Order NO-UNDO:
DISPLAY OrderLine.LineNum OrderLine.ItemNum OrderLine.Qty
OrderLine.Price (OrderLine.Qty * OrderLine.Price) LABEL "Ext Price".
ACCUMULATE OrderLine.Qty * OrderLine.Price (TOTAL).
DISPLAY (ACCUM TOTAL OrderLine.Qty * OrderLine.Price) LABEL "Accum Total".
END.
DISPLAY (ACCUM TOTAL OrderLine.Qty * OrderLine.Price) LABEL "Total".
END.
DISPLAY (ACCUM TOTAL OrderLine.Qty * OrderLine.Price) LABEL "Grand Total"
WITH ROW 1.
ACCUMULATE { expression ( aggregate-phrase ) } ...
Syntax
{ AVERAGE | COUNT | MAXIMUM | MINIMUM | TOTAL | SUB-AVERAGE
| SUB-COUNT | SUB-MAXIMUM | SUB-MINIMUM | SUB-TOTAL
} ... [ BY break-group ] ...
ACCUMULATE statement
35
The following procedure lists each item with its inventory value and lists that value as a
percentage of the total inventory value of all items; it sorts items by highest value.
The following procedure displays all customers, sorted by salesrep and country within the list
for each salesrep. The procedure calculates the balance for each customer, total balance for each
country, and total balance for each salesrep.
Note You can use the ACCUMULATE statement only in blocks with the implicit looping property.
ABL automatically supplies looping services to REPEAT and FOR EACH blocks. See
OpenEdge Getting Started: ABL Essentials for more information on block properties.
See also ACCUM function, Aggregate phrase
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Friday, June 24, 2016 11:54 AM
To: vantage@yahoogroups.com
Subject: [Vantage] GROUP BY in 4GL/ABL (V 8.03)
Is there a way to group records in 4GL/ABL ?
I currently have
FOR Each GLJrnDtl WHERE (GLJrnDtl.Company = 'MC' AND GLJrnDtl.JournalCode = 'SJ' AND GLJrnDtl.JEDate = dPostDate),
EACH GLAcct WHERE (GLAcct.Company = GLJrnDtl.Company AND GLAcct.Chart = GLJrnDtl.GLChart AND GLAcct.Division = GLJrnDtl.GLDiv AND GLAcct.GLDept = GLJrnDtl.GLDept).
But need the GLJrnDtl records grouped by GLAcct.DisplayAccount, with the GLJrnDtl.TransAmt sum for each group.
I've been through the Progress OpeEdge 4GL Reference but don't see how to do it.
Any help would be appreciated.
CONFIDENTIALITY NOTICE
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6240 and immediately delete the communication.
"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."