Relation Loops


A relation loop is a template file construct which allows you to iterate through the collection of relations that CodeGen has information about.  In order to use a relation loop you must be processing a repository structure, either directly via the –s command line option, or because the structure is referenced by the UI Toolkit input window that you are processing via the –w command line option.

Relation loops are delimited by a matching pair of <RELATION_LOOP> and </RELATION_LOOP> tags that surround the template code to be inserted for each relation.

The code between the opening and closing tags of a relation loop is repeated for each relation in the structure being processed. This code within a relation loop can contain other generic and structure tokens, and can also contain special relation loop tokens, which are discussed later. Relation loop tokens can only be used inside a relation loop, and a relation loop can’t be declared within most other loop constructs (except structure loops).

Relation loop tokens are tokens that can only be used within a relation loop:

Relation Loop Expansion Tokens

Relation Loop Expression Tokens

There are two types of relation loop, multi-line relation loops and in-line relation loops.

Multi-Line Relation Loops

Multi-line relation loops occur when the opening and closing relation loop tags appear on separate lines in a template file, and delimit one or more entire lines of template code, like this:




Multi-line relation loops generate one or more lines of output code for each relation that is processed.

In-Line Relation Loops

In-line relation loops exist when the opening and closing relation loop tags appear on the same line in a template file, and delimit part of a line of template code, like this:

[code] <RELATION_LOOP> code </RELATION_LOOP> [code]

In-line relation loops generate code into the current output line only.




Copyright © 2018  Synergex International, Inc.