Chapter 9 Generation Reference Guide (GTL)


convert_name macro

The .convert_name macro uses the conversion table of a name into a code. When no occurrence is found in the table, the name is returned.

.convert_name (<Expression> [,<separator character> [,<pattern separator>]])

The expression <Expression> is the name to be converted in the corresponding conversion table.

Parameters

Parameter Type Description
<pattern separator> (optional) Text Declaration of the different separators likely to exist in a name. These separators will be replaced by the <separator character>. You can declare several separators, for example "space " and "tab"
<separator character> (optional) Text Character generated each time a separator declared in <pattern separator> is found in the name. For example, this character can be "_"

You can use the .convert_name macro 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 Name To Code tab.

Conversion tables are not case sensitive. You can indifferently use lower or uppercases in tables. This macro is particularly useful when you work with naming conventions.

For more information about naming conventions, see "Defining naming conventions" in the "Managing Models" chapter in the General Features Guide.

Note

You can also use this macro 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 the .convert_name macro, see ".convert_name & .convert_code macros" in the "Defining name/code conversions" chapter in the General Features Guide .

 


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