Custom Field Loop Expressions

unlisted

Custom Field Loop Expressions

 

CodeGen supports custom conditional expressions in field loops via the <IF CUSTOM_expression> template_code </IF> and <IF NOT_CUSTOM_expression> template_code </IF> tags. Custom field loop expressions test the presence or absence of some piece of text in a fields user text or long description.

There are two types of custom field loop expressions.

Multi-Line Custom Field Loop Expressions

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

<FIELD_LOOP>[code]
<IF CUSTOM_expression>
conditional code
[<ELSE>
conditional code]
</IF[ CUSTOM_expression]>
[code]
</FIELD_LOOP>

Multi-line custom field loop expressions cause one or more lines of output code to be included or excluded, based on the evaluation of the expression.

In-Line Custom Field Loop Expressions

In-line custom field loop expressions occur when the opening and closing conditional tags appear on the same line in a template file, and delimit part of a line of template code, like this:

<FIELD_LOOP>
[code]
[code] <IF CUSTOM_expression> conditional code </IF[ CUSTOM_expression]> [code]
[code]
</FIELD_LOOP>

In-line custom field loop expressions cause part of an output line to be included or excluded based on the evaluation of the expression.

Nested Expressions

Multi-line expressions may be nested within one another, and in-line expressions may be nested within multi-line expressions. However, in-line expressions may not be nested inside one another.

Custom Field Loop Expression Example

An example of using a custom field loop expression might be if you wanted to arbitrarily exclude certain fields in a structure from being processed within a field loop. You could decide to add the text IGNORE_ME to the fields user text, or to the fields long description. You could then test the presence, or absence of this string with custom expression tags, like this:

<FIELD_LOOP>

<IF CUSTOM_IGNORE_ME>
code for fields WITH the custom text
</IF>

<IF CUSTOM_NOT_IGNORE_ME>
code for fields WITHOUT the custom text
</IF>

</FIELD_LOOP>

 

 

 


Copyright © 2018  Synergex International, Inc.