Use a DO block to scope records and frames
- Last Updated: April 25, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
You will learn more about record scoping in Record scope, but it is helpful to cover all the syntax forms that can affect it before discussing the
meaning of record scope in different situations. For now, you can scope or associate records
in one or more tables with a DO block by using the FOR phrase:
|
Each record names a record you want to work with in the block and scopes it to the block. References within that block to fields the record contains are automatically associated with that record.
You have already seen an example of frame scoping in the code in the enable_UI procedure of h-CustOrderWin2.w and in the button triggers you created based on that code:
|
You can use the phrase WITH FRAME frame-name and, optionally, IN
WINDOW window-name to identify which frame you
are talking about when you display fields or take other actions on objects in frames. If you
wish, you can scope all the statements in a DO block with a
frame by appending the WITH FRAME phrase to the DO statement itself.
For example, here is the BtnNext trigger
block again with the frame qualifier moved to the DO
statement:
|
Whether you name the frame in individual statements or in the block header, this makes sure that the AVM understands that you want the fields displayed in the frame where you defined them. If you do not do this, then depending on the context, the AVM might display the fields in a different frame.
There are other phrases you can use to qualify a DO block,
but they mostly deal with transactions and error handling, which
is described in Manage Transactions.