Form vs No Form

nate100

Member
How is it that the following code :

def var sonbr as char.

form
sonbr
with frame a.

for each so_mstr where so_domain = "xyz" no-lock:
disp so_nbr @ sonbr with frame a.
end.

displays the field without pausing on the frame.

But the following code allows for pauses:

def var sonbr as char.
form
sonbr
with frame a.

for each so_mstr where so_domain = "xyz" no-lock:
disp so_nbr.
end.
 
To be honest, I thought this was a dumb question when I read it, but when I tried the code, I see your point, and I don't really know the answer.

My guess is the use of '@' screws up PSC's normal logic for pausing and down frames. I noticed explicitly adding PAUSE BEFORE-HIDE does not help.

We don't do much CUI development these days, I do stick '@'s into reports frequently but of course the pause situation is different there.
 
I also thought it was a silly question, but when I tried it out with a random table on my database with similar logic it worked perfectly for me so I am a bit confused as to why you get the issue.
 
I don't want to talk about versions because I don't want a lecture from Tom ;)... but on my "not entirely up to date" version, the first chunk of code (a) is not a down frame as one would expect, and (b) does not pause between display of data.

The second chunk is both down and does pause.
 
It is expected functionality. If you want it to pause define the form inside of the for each block.
Code:
def var sonbr as char.
for each so_mstr where so_domain = "xyz" no-lock:
form
sonbr
with frame a.
disp so_nbr @ sonbr with frame a.
end.
Otherwise, Progress looks at it as a regular frame and doesn’t pause unless you tell it to.
 
It's a matter of frame scope, similar to record scope etc.

In the first example, because it is defined as a "FORM", the frame is scoped to the outer block, not the FOR EACH. Without the "with DOWN" it defaults to a 1 down without pausing unless you specifically tell it to pause after each display as rusguy noted.

Also, as was stated by rusguy, putting the FORM inside the FOR EACH scopes it to the FOR EACH block, which will make it by definition a 1 down frame with pausing when you don't specify "with DOWN".

If you add "DOWN" after the "WITH", it will make it a down form for the length of the terminal screen area, and pause after x number of lines are displayed.

The alternative method for a single line down frame:
Code:
def var sonbr as char no-undo.
 
def frame a sonbr.

for each so_mstr where so_domain = "xyz" no-lock:
 disp  so_nbr @ sonbr  with frame a.
end.
In this case, "def frame" does NOT scope it to the outer block as DEF FRAME has no scope until it is used.

... or for a multi-line down frame:

Code:
def var sonbr as char no-undo.
  
def frame a sonbr with down.

 for each so_mstr where so_domain = "xyz" no-lock:
  disp  so_nbr @ sonbr  with frame a.
 end.
The second example you gave has no reference to frame a in the display statement, so it uses the Progress 4GL/ABL default for a FOR EACH, which is a down frame with pausing.

The fact that one uses the table field and one uses a temp var means nothing.
 
Back
Top