Previous Topic Next topic Print topic


Overriding Nesting Levels

Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Depending on what you want your program to do, you might need to override the nesting levels of loops to nest them under different loops, or to execute them independently of other loops. By default, Online Express assigns default nesting levels to each loop in the Nesting Level field on the Attributes dialog box. For example, if you define three loops in your program, their default Nesting Level field values are:

Loop

Nesting Level

Description

1

0

Loop is not nested

2

1

Loop is nested within loop 1

3

2

Loop is nested within loop 2

You can decrease but not increase the default nesting level of any loop simply by changing the Nesting Level field value. For example, if you want the second loop to execute independently of the first loop, you change its nesting level from 1 to 0. Or, if you want the third loop to be nested within the first loop rather than the second, you change its nesting level from 2 to 1. Online Express ensures that your nesting levels do not skip a level. For example, you cannot specify a level 0 loop followed by a level 2 loop.

When you override nesting levels, you specify the outermost loop - a level 0 loop - whose records you plan to map to your screen.

In the figure below, the program must display all items to be included in the next shipment to a certain customer. The first loop reads all outstanding orders for the customer and executes a user-defined routine to determine which order ships next. The second loop obtains all detail records of the order found by the first loop, and maps them to a repeated record block.

Note that, if the program shown here uses the default nesting level of the second loop, it would not execute as required. The program would loop on and obtain all customer order records and their detail records. In addition, Online Express would assume that records of the first loop will map to the screen.

Figure 1. Overriding Nesting Levels
Overriding Nesting Levels

The next figure illustrates how to make the program execute as required.

Figure 2. Executing Nested Calls
Executing Nested Calls
Previous Topic Next topic Print topic