Using a DOWN frame and the DOWN WITH statement
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
As a small digression, it is necessary to explain a
couple of statements in this example that you haven't seen before.
They illustrate one of the key characteristics of queries: there's
no built-in block scoping or iteration in a query. First, here's
the new phrase on the DISPLAY statement:
|
You learned a little about down frames in Using Basic ABL Constructs. A down frame is a frame
that can display more than one row of data, each showing the same
fields for a different record in a report-like format. In the examples
you wrote in earlier chapters, you didn't have to specify the DOWN phrase
to indicate the number of rows to give the frame. The AVM gave you
a down frame with a default number of rows automatically.
Why doesn't it do that in this case? Because a query is not associated with a particular block, and doesn't have any automatic iteration, the AVM doesn't know how the data is going to be displayed. So by default, it just gives you a one down frame that displays a single record.
The second new piece of syntax is this statement at the end of the block:
Syntax
|
No, this is not a political protest slogan! Rather, it tells
the AVM to display a row in the frame CustFrame,
and then to position down a row in the frame before displaying the
next row. If you don't use this statement, then even if you define
the frame to be 15 DOWN, all the rows are displayed
on top of each other on the first row of the frame. Once again,
this is because the AVM doesn't know how you're going to display
the data. It does not associate iteration through a result set with your DO block
automatically, as it would with a FOR EACH block.
Therefore, you have to tell it what to do.