skujins
skujins

Reputation: 395

Loop through all the records of datablock in Oracle forms

I am trying to learn Oracle forms (v6.0). In a when-button-pressed trigger I am trying to loop through all of the records from a datablock. So far I have following code:

BEGIN
    GO_BLOCK('MY_BLOCK');
    FIRST_RECORD;
    LOOP
    MESSAGE(:MY_BLOCK.DSP_NAME);
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    NEXT_RECORD;            
    END LOOP;   
END;

When I run the code all the DSP_NAME values are displayed except the last one. If I add :

MESSAGE(:MY_BLOCK.DSP_NAME);

after the loop, then the DSP_NAME value of the last record is displayed. Why it is like that - the message is displayed before the last record check? and what would be the right way to loop through the records?

Upvotes: 9

Views: 74925

Answers (2)

Ameer Usman
Ameer Usman

Reputation: 21

To get a pop up window use the same line twice :

MESSAGE(:MY_BLOCK.DSP_NAME);

MESSAGE(:MY_BLOCK.DSP_NAME);

You'll get it this way.

Upvotes: 2

GriffeyDog
GriffeyDog

Reputation: 8376

Your loop is correct. I suspect the last message is showing up in the status bar at the bottom of the form instead of as a popup window.

Upvotes: 10

Related Questions