Recursive REPEATs

You define a REPEAT command to be recursive by adding additional logic to a standard REPEAT command. A recursive REPEAT drills down through a defined structure and extracts the selected artifacts using a single REPEAT command.

§  A standard REPEAT command finds every occurrence of the high level object you select.
For example, a REPEAT can find the packages within a model.

§  A recursive REPEAT finds objects of the same type within that high level object type.
For example, a recursive REPEAT additionally finds the packages within those packages.

This is an example of a standard REPEAT, where packages are found within a model:

     Model
          Package 1
          Package 2

This is an example of a recursive REPEAT that looks for subpackage information within each high level package that is found:

     Model
          Package 1
               Package 1.1
               Package 1.2
                    Package 1.2.1
                    Package 1.2.2
               Package 1.3
          Package 2
               Package 2.1

You can limit recursive REPEAT commands to recurse through a fixed number of levels by setting a parameter in the ProjectConsole.ini file.

How to Define a Recursive REPEAT Command

To define a recursive repeat, you define a standard repeat, then use the advanced section of the REPEAT Command dialog box to add the recursion to it. The recursion is an additional step in a standard REPEAT command that instructs the command to recurse.

The example dialog boxes in this procedure show how to set up the recursive repeat illustrated above, one that finds all subpackages within each high level package in a Rose Model.

 

1. Begin defining the standard REPEAT command, selecting the high level object that you want to find.

image\recursion1.gif

2. Select the Advanced check box to reveal the advanced features available for REPEAT commands.

image\recursion2.gif

3. In the Recursion area at the bottom of the expanded dialog box, click Add.

The Recursion version of the REPEAT Command dialog box appears. This is where you select the recursion that is within the main REPEAT selection.

image\recursion3.gif

Note: The And Where and Sort By features do not need to be the same for the recursed sections as they are for the main sections.

4. Make your selection for recursion, then click Accept.

NOTE: A recursive REPEAT allows only the same type object to be selected.

The advanced version of the REPEAT Command dialog box appears again, with your selection for recursion displayed in the Recursive box.

image\recursion4.gif

5. Click OK to return to your starting point.

You can see the recursive REPEAT logic In the Template View.

image\recursion5.gif