[Stackoverflow] [Progress OpenEdge ABL] Openedge record scope using for each and first-of

  • Thread starter Thread starter Darren
  • Start date Start date
Status
Not open for further replies.
D

Darren

Guest
I have a bit of a puzzling problem that I have never encountered before. Running in a production environment this seems to be fine but in a standalone procedure editor or mpro session it is failing so I would like to understand why..

Code:
FOR EACH employee NO-LOCK BREAK BY employee.company:
    IF FIRST-OF(employee.company) THEN 
    DO:
        FIND company WHERE company.company = employee.company NO-LOCK NO-ERROR.
    END.

    MESSAGE FIRST-OF(employee.company) SKIP
            AVAILABLE company
         VIEW-AS ALERT-BOX. 
END.

I was expecting that providing the company record exists, for each employee record of that company I would see that the company record is available, this is not the case, once we hit the second occurrence of the company it is no longer available.

I can get it to work using strong scoping as seen below but I would like to know whether or not there is some kind of start up parameter or something that I am missing as, as stated above this works fine in a production environment in its program. I should add that the code in the production environment lives in a procedure in a standard .p.

Code:
DO FOR employee, company:
    FOR EACH employee NO-LOCK BREAK BY employee.company:
        IF FIRST-OF(employee.company) THEN 
        DO:
            FIND company WHERE company.company = employee.company NO-LOCK NO-ERROR.
        END.

        MESSAGE FIRST-OF(employee.company) SKIP
                AVAILABLE company
            VIEW-AS ALERT-BOX. 
    END.
END.

Continue reading...
 
Status
Not open for further replies.
Back
Top