.convert_name and .convert_code Macros

These macros convert the object name to its code (or vice versa) and can search for and apply values found in an associated conversion table.

Use the following syntax to convert a name to a code:

.convert_name (expression[,"separator"[,"delimiters"],case])

Use the following syntax to convert a code to a name:

.convert_code (expression[,"separator"[,"delimiters"]])

The following parameters are available:

Parameter

Description

expression

Specifies the text to be converted. For .convert_name, this is generally the %Name% variable and may include a suffix or prefix.

Type: Simple template

separator

[optional] Character generated each time a separator declared in delimiters is found in the code. For example, "_" (underscore).

Type: Text

delimiters

[optional] Specifies the different delimiters likely to exist in the input code or name, and which will be replaced by separator. You can declare several separators, for example "_ " and "-"

Type: Text

case

[optional for .convert_name only] Specifies the case into which to convert the code. You can choose between:
  • firstLowerWord - First word in lowercase, first letters of subsequent words in uppercase
  • FirstUpperChar - First character of all words in uppercase
  • lower_case - All words in lowercase and separated by an underscore
  • UPPER_CASE - All words in uppercase and separated by an underscore
Examples
In this example, the template is applied to class name Corporate Customer:
.convert_name (cls_%Name%[,,,FirstUpperChar])
Result:
clsCorporateCustomer
In this example, the template produces a list of column names before and after conversion:
.foreach_item(Columns)
 %Name%,
 .foreach_part(%Name%)
  .convert_name(%CurrentPart%,,,lower_case)
 .next()
.next(\n)
Result:
 Column 1, column_1
 Column 2, column_2
 Column 3, column_3