Chapter 5 Customizing Generation with GTL


.convert_code and .convert_name macros

These macros use conversion tables to convert from the object code to name or vice versa. When no occurrence is found in the table, the input code or name is returned.

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

.convert_code (expression [separator-character [,pattern-separator]])

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

.convert_name (expression [separator-character [,pattern-separator]])

The following parameters are available:

Parameter Description
expression The code to be converted in the corresponding conversion table.

Type: Simple template
separator-character [optional] Character generated each time a separator declared in pattern-separator is found in the code. For example, " " (space).

Type: Text
pattern-separator [optional] Declaration of the different separators likely to exist in a code. These separators will be replaced by the <separator character>. You can declare several separators, for example "_ " and "tab"

Type: Text

You can use these macros together with a user-defined conversion table that you select in the Conversion Table list. To do so, open the Model Options dialog box, select the required object in the Naming Convention folder and click the Code To Name tab.

For more information about naming conventions, see "Naming conventions" in the Models chapter of the Core Features Guide.

Note

You can also use these macros outside the naming conventions context provided the conversion table is the table of the current object of the script. Here is an example of a macro that can be added from the Profile\Column folder in a new Generated Files entry:

.foreach_item(Columns)
   %Name%,
   .foreach_part(%Name%)
      .convert_name(%CurrentPart%)
   .next("_")
.next(\n)

For more information on these macros, see ".convert_name & .convert_code macros" in the Models chapter of the Core Features Guide .

 


Copyright (C) 2008. Sybase Inc. All rights reserved.