Skip to main content

Posts

Showing posts from May, 2026

How to Use ACCUMULATE in Progress 4GL | SQL SUM Equivalent

Hello developer friends! This week I want to talk about the ACCUM function in Progress 4GL . This function works similarly to the SQL SUM function. Both functions are used to consolidate or calculate the total value of a field based on specific conditions. For example, if you want to calculate the total invoiced sales amount by customer, the SQL statement would look like this: SELECT SUM(ih_invoicetotal), ih_bill FROM ih_hist WHERE ih_domain = 'domain' AND YEAR(ih_inv_date) = 2019 GROUP BY ih_bill Now, the same example written in Progress 4GL: FOR EACH ih_hist WHERE ih_domain = 'domain' AND YEAR(ih_inv_date) = 2019 NO-LOCK BREAK BY ih_bill: ACCUMULATE ih_invoicetotal (TOTAL BY ih_bill). IF LAST-OF(ih_hist.ih_bill) THEN DISPLAY ACCUM TOTAL BY ih_bill ih_invoicetotal ih_bill. END. As shown in the images, both approaches generate the same result. The Progress functions used in this example were: ...