#INSERT (insert code from a #GROUP) 

Top  Previous  Next

 

#INSERT( symbol [ ( set ) ] [, parameters ] )[, returnvalue ] [, NOINDENT ]

#INSERT

Inserts code from a #GROUP.

symbol

A symbol that names a #GROUP section.

set

The #TEMPLATE name parameter for the template set to which the #GROUP belongs. If omitted, the #GROUP must be of the same template set name as the #PROCEDURE in which it is used.

parameters

The parameters passed to the #GROUP. Each parameter must be separated by a comma. All parameters defined for the #GROUP must be passed; they may not be omitted.

returnvalue

A symbol to receive the value returned by the #RETURN statement.

NOINDENT

Specifies the code inserted retains the indention in its #GROUP--any source in column 1 in the #GROUP is generated into column 1, no matter where the #INSERT is placed.

The #INSERT statement places, at the exact position the #INSERT is located within the Template code, the code from the #GROUP named by the symbol. The set parameter specifies the #TEMPLATE that contains the #GROUP. This allows any Template to use #GROUP code from any other registered Template.

The parameters passed to the #GROUP fall into two categories: value-parameters and variable-parameters. Value-parameters are declared by the #GROUP as a user-defined symbol, while variable-parameters are declared by the #GROUP as a user-defined symbol with a prepended asterisk (*). Either a symbol or an expression may be passed as a value-parameter. Only a symbol may be passed as a variable-parameter.

The returnvalue symbol receives the value returned by the #GROUP from the #RETURN statement that terminates the #GROUP. If the #GROUP does not contain a #RETURN statement, or that #RETURN does not have a parameter, then the value received is an empty string ('').

Example:

#INSERT(%SomeGroup)                      #!Ordinary insert

#INSERT(%GenerateFormulas(Clarion))      #!Insert #GROUP from Clarion Template

#INSERT(%FileRecordFilter,%Secondary)    #!Insert #GROUP with passed parameter

 

#!#GROUP from Clarion Template with two passed parameters:

#INSERT(%FileRecordFilter(Clarion),%Primary,%Secondary)

 

See Also:     #GROUP ,#CALL ,#RETURN