Navigation: Templates > Template Language Reference > Complete Alpha Listing >====== #INVOKE (insert code from a named #GROUP) ====== | |
#INVOKE( symbol [, parameters ] ) [, returnvalue ] [, NOINDENT ]
#INVOKE | Inserts code from a named #GROUP. |
symbol | A symbol containing the name of a #GROUP section (including the #TEMPLATE to which it belongs). |
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 #INVOKE statement places, at the exact position the #INVOKE is located within the Template code, the code from the #GROUP named in the symbol. The symbol must contain the name of a #GROUP, including the #TEMPLATE set to which it belongs. The main difference between #INVOKE and #CALL is the symbol parameter, which is a variable containing the #GROUP to call in #INVOKE and a constant naming the #GROUP to call in #CALL.
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:
#SET(%SomeGroup,'%GenerateFormulas(Clarion)') #!Set variable to a #GROUP name
#INVOKE(%SomeGroup)
#SET(%SomeGroup,'%FileRecordFilter(Clarion)') #!Set variable to another #GROUP name
#INVOKE(%SomeGroup,%Secondary) #!Insert #GROUP with passed parameter
#INVOKE(%SomeGroup,%Primary,%Secondary) #!#GROUP with two passed parameters