Break by inside Dynamic Query

rcgomez11

Member
Good day ProgressTalkers,
Progress Version: 9.1E
License: Enterprise

I just want to know how can I implement break by keyword correctly inside dynamic query, when I tried to use "dbQuery:first-of(0)" with this query "dbQuery:QUERY-PREPARE('preselect each account-dtl where account-dtl.property-id eq 0 no-lock break by account-dtl.pID')", prompt me like "unknown attribute first-of"...Thanks in advance and please help me, I need it badly...

Sincerely,
Romel Gomez
 

Cringer

ProgressTalk.com Moderator
Staff member
BREAK BY does not work in Progress 9.1E for dynamic queries. It was something that was implemented in OE10. You will need to upgrade. Alternatively use your dynamic query to populate a temp-table with data and then run a BREAK BY on the temp table.
 

Osborne

Active Member
I seem to recall Progress having some solutions a while back for version 9.1 but can only find the one and if any help:

The following code demonstrates how to emulate the FIRST-OF function when working with the query, buffer and buffer-field objects. This code works with the Order table of the Sports2000 database:
Code:
DEFINE VARIABLE hQ AS HANDLE    NO-UNDO.
DEFINE VARIABLE hB AS HANDLE    NO-UNDO.
DEFINE VARIABLE hF AS HANDLE    NO-UNDO.
DEFINE VARIABLE hO AS HANDLE    NO-UNDO.
DEFINE VARIABLE cF AS CHARACTER NO-UNDO.

CREATE QUERY hQ.
CREATE BUFFER hB FOR TABLE "Order".

hQ:SET-BUFFERS(hB).
hQ:QUERY-PREPARE("FOR EACH Order NO-LOCK BY CustNum").
hQ:QUERY-OPEN().
hQ:GET-FIRST().

ASSIGN hF = hB:BUFFER-FIELD("CustNum")
       hO = hB:BUFFER-FIELD("OrderNum").

DO WHILE NOT hQ:QUERY-OFF-END:
    DISPLAY hF:BUFFER-VALUE hO:BUFFER-VALUE WITH DOWN FRAME xx.
    IF cF NE hF:BUFFER-VALUE THEN 
        DO:
            ASSIGN cF = hF:BUFFER-VALUE.
            DISPLAY "First-Of" WITH DOWN FRAME xx.
        END.
    DOWN WITH FRAME xx.
    hQ:GET-NEXT().
END.
 
Top