CodeGen Documentation
CodeGen Documentation

File Header Tokens

 

File header tokens are a special class of token that provides high level processing information to the code generator. None of the file header tokens cause any output to be written directly to the output stream of the current template. All file header tokens consist of a pair of matching opening and closing tags that surround some significant value. Any file header tokens that you use in a template file must appear together at the very top of the template file.

The file header tokens are:

File Header Token

Description

<CODEGEN_FILENAME>

Video: Controlling Output File Names

This file header token allows you to define the name of the output file from within a template file. The name of the output file should appear between the tokens opening and closing tags. The opening and closing tags must be on the same line.

File header tokens must be grouped together at the top of the template file.

Usage: <CODEGEN_FILENAME>SomeFile.txt</CODEGEN_FILENAME>

The file name that you specify may contain generic expansion tokens or structure expansion tokens, which will be expanded as normal.

Example: <CODEGEN_FILENAME>Get<StructureName>.dbl</CODEGEN_FILENAME>

<CODEGEN_FOLDER>

 

This file header token allows you to specify that any output files created from the template should be placed into a named sub-folder below the main output folder. The name of the sub-folder should appear between the tokens opening and closing tags. The opening and closing tags must be on the same line.

File header tokens must be grouped together at the top of the template file.

To enable the use of this token you must use the -tf command line option.

By default, if a namespace is being used, then the folder name will also appended to the namespace, but that behavior can be overridden by using the -nf command line option.

Example:  <CODEGEN_FOLDER>ViewModel</CODEGEN_FOLDER>

<OPTIONAL_USERTOKEN>

This file header token allows you to provide a default value for an optional user defined token. If the user-defined token has been specified via other mechanisms then that value will be used when generating code from the template, but if not then the default value specified in this token will be used.

File header tokens must be grouped together at the top of the template file.

Example:  <OPTIONAL_USERTOKEN>MYTOKEN=MyValue</OPTIONAL_USERTOKEN>

See also: <REQUIRES_USERTOKEN>, User defined expansion tokens

<PROCESS_TEMPLATE>

Video: Configuring Template Dependencies

This file header token allows you to specify that an additional template is to be processed after the processing of the current template completes. The name of the additional template to process is specified between the opening and closing tags to the token.

File header tokens must be grouped together at the top of the template file.

Example:  <PROCESS_TEMPLATE>other_template.tpl</PROCESS_TEMPLATE>

See also:  <PROVIDE_FILE>

<PROVIDE_FILE>

This file header token allows you to specify that an additional file is also provided to the output directory as part of the processing of the current template. The name of the file to be provided can include a logical name, otherwise CodeGen will expect to find the file in the same directory as your template files. If the file already exists in the output directory then it will not be replaced, even if the -r command line option is specified.

File header tokens must be grouped together at the top of the template file.

Example:  <PROVIDE_FILE>INC:somefile.def</PROVIDE_FILE>

See also:  <PROCESS_TEMPLATE>

<REQUIRES_CODEGEN_VERSION>

 

This file header token allows you to specify that a minimum version of CodeGen is required in order to successfully process the template. If the version of CodeGen being used does not satisfy this requirement then processing will terminate and an error message will be displayed.

 

NOTE: This token was introduced in CodeGen 5.2.1 and earlier versions will not process this token correctly. If a template containing this token is processed by an earlier version of CodeGen then it will not be recognized as a valid token and the token will simply be propagated into the output stream. This will almost certainly cause the generated code to fail, and the presence of the token in your output file will be an indication of the problem.

 

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CODEGEN_VERSION>5.2.1</REQUIRES_CODEGEN_VERSION>

<REQUIRES_CUSTOM_BUTTON_EXPRESSION>

This file header token allows you to specify that a particular custom button loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_BUTTON_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_BUTTON_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_BUTTON_TOKEN>

This file header token allows you to specify that a particular custom button loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_BUTTON_TOKEN>MYTOKEN</REQUIRES_CUSTOM_BUTTON_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_ENUM_EXPRESSION>

This file header token allows you to specify that a particular custom enumeration loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_ENUM_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_ENUM_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_ENUM_TOKEN>

This file header token allows you to specify that a particular custom enum loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_ENUM_TOKEN>MYTOKEN</REQUIRES_CUSTOM_ENUM_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_ENUM_MEMBER_EXPRESSION>

This file header token allows you to specify that a particular custom enumeration member loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_ENUM_MEMBER_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_ENUM_MEMBER_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_ENUM_MEMBER_TOKEN>

This file header token allows you to specify that a particular custom enum member loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_ENUM_MEMBER_TOKEN>MYTOKEN</REQUIRES_CUSTOM_ENUM_MEMBER_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_EXPRESSION>

 

This file header token allows you to specify that a particular custom generic or structure expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_FIELD_EXPRESSION>

This file header token allows you to specify that a particular custom field loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_FIELD_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_FIELD_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_FIELD_TOKEN>

This file header token allows you to specify that a particular custom field loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_FIELD_TOKEN>MYTOKEN</REQUIRES_CUSTOM_FIELD_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_FILE_EXPRESSION>

This file header token allows you to specify that a particular custom file loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_FILE_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_FILE_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_FILE_TOKEN>

This file header token allows you to specify that a particular custom file loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_FILE_TOKEN>MYTOKEN</REQUIRES_CUSTOM_FILE_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_KEY_EXPRESSION>

This file header token allows you to specify that a particular custom key loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_KEY_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_KEY_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_KEY_TOKEN>

This file header token allows you to specify that a particular custom key loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_KEY_TOKEN>MYTOKEN</REQUIRES_CUSTOM_KEY_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_LOOPUTIL_EXPRESSION>

This file header token allows you to specify that a particular custom loop utility expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_LOOPUTIL_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_LOOPUTIL_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_LOOPUTIL_TOKEN>

This file header token allows you to specify that a particular custom loop utility token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_LOOPUTIL_TOKEN>MYTOKEN</REQUIRES_CUSTOM_LOOPUTIL_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_NOTINLOOP_EXPRESSION>

This file header token allows you to specify that a particular custom "not in loop" expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_NOTINLOOP_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_NOTINLOOP_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_NOTINLOOP_TOKEN>

This file header token allows you to specify that a particular custom "not in loop" token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_NOTINLOOP_TOKEN>MYTOKEN</REQUIRES_CUSTOM_NOTINLOOP_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_RELATION_EXPRESSION>

This file header token allows you to specify that a particular custom relation loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_RELATION_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_RELATION_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_RELATION_TOKEN>

This file header token allows you to specify that a particular custom relation loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_RELATION_TOKEN>MYTOKEN</REQUIRES_CUSTOM_RELATION_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_SEGMENT_EXPRESSION>

This file header token allows you to specify that a particular custom key segment loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_SEGMENT_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_SEGMENT_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_SEGMENT_TOKEN>

This file header token allows you to specify that a particular custom key segment loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_SEGMENT_TOKEN>MYTOKEN</REQUIRES_CUSTOM_SEGMENT_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_SELECTION_EXPRESSION>

This file header token allows you to specify that a particular custom field selection loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_SELECTION_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_SELECTION_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_SELECTION_TOKEN>

This file header token allows you to specify that a particular custom field selection loop loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_SELECTION_TOKEN>MYTOKEN</REQUIRES_CUSTOM_SELECTION_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_STRUCTLOOP_EXPRESSION>

This file header token allows you to specify that a particular custom structure loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_STRUCTLOOP_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_STRUCTLOOP_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_STRUCTLOOP_TOKEN>

This file header token allows you to specify that a particular custom structure loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_STRUCTLOOP_TOKEN>MYTOKEN</REQUIRES_CUSTOM_STRUCTLOOP_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_TAG_EXPRESSION>

This file header token allows you to specify that a particular custom tag loop expression is required in order to be able to successfully generate code from the template. If the specified custom expression has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_TAG_EXPRESSION>MYEXPRESSION</REQUIRES_CUSTOM_TAG_EXPRESSION>

See also:  Custom Expression Tokens

<REQUIRES_CUSTOM_TAG_TOKEN>

This file header token allows you to specify that a particular custom tag loop token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_TAG_TOKEN>MYTOKEN</REQUIRES_CUSTOM_TAG_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_CUSTOM_TOKEN>

This file header token allows you to specify that a particular custom generic or structure expansion token is required in order to be able to successfully generate code from the template. If the specified custom token has not been provided when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_CUSTOM_TOKEN>MYTOKEN</REQUIRES_CUSTOM_TOKEN>

See also:  Custom Expansion Tokens

<REQUIRES_OPTION>

This file header token allows you to specify that a particular command line option is required in order to be able to successfully generate code from the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_OPTION>code</REQUIRES_OPTION>

Supported Options

 Code

 Command Line Option

 Description

 FL

 -f l

 Include fields which are "Excluded by Language" in field loop processing.

 FO

 -f o

 Include overlay fields in field loop processing.

 FR

 -f r

 Exclude fields which are "Excluded by ReportWriter" from field loop processing.

 FT

 -f t

 Exclude fields which are "Excluded by Tookit" from field loop processing.

 FW

 -f w

 Exclude fields which are "Excluded by Web" from field loop processing.

 MS

 

 -ms

 Process multiple structures at the same time.

 PREFIX

 -prefix <value>

 Prefix field names with <value>.

 SUBSET

 -subset <name>

 Only process fields belonging to the named subset.

 TF

 

-tf

Allow template-defined folders.

If the required command line option was not used when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

See also:  Command Line Reference

<REQUIRES_USERTOKEN>

This file header token allows you to specify that a particular user-defined token is required in order to be able to successfully generate code from the template. If the required user-defined token has not been specified when attempting to generate code from the template then CodeGen will display an error and will stop processing the template.

File header tokens must be grouped together at the top of the template file.

Example:  <REQUIRES_USERTOKEN>MYTOKEN</REQUIRES_USERTOKEN>

See also:  <OPTIONAL_USERTOKEN>, User defined expansion tokens

 

 


Copyright © 2021  Synergex International, Inc.