Formatting Your Output

You can change the formatting of variables by embedding formatting options in variable syntax. New lines and tabs are specified using the \n and \t escape sequences respectively.

%[[-][x][.[-]y][options]:]variable%

The following variable formatting options are available:

Option

Description

[-][x].[-]y[M]

Extracts the first y characters or, for -y, the last y characters.

If x is specified, and y is lower than x, then blanks or zeros are added to the right of the extracted characters to fill the width up to x. For -x, the blanks or zeros are added to the left and the output is right-justified.

If the M option is appended, then the first x characters of the variable are discarded and the next y characters are output.

Thus, for an object named abcdefghijklmnopqrstuvwxyz (with parentheses present simply to demonstrate padding):
Template                Output
(%.3:Name%)     gives   (abc)
(%.-3:Name%)    gives   (xyz)
(%10.3:Name%)   gives   (abc       )
(%10.-3:Name%)  gives   (xyz       )
(%-10.3:Name%)  gives   (       abc)
(%-10.-3:Name%) gives   (       xyz)
(%10.3M:Name%)  gives   (jkl)

L[F], U[F], and c

Converts the output to lowercase or uppercase. If F is specified, only the first character is converted. c is equivalent to UF.

q and Q

Surrounds the variable with single or double quotes.

A

Removes indentation and aligns text on the left border.

T

Trims leading and trailing whitespace from the variable.

H

Converts number to hexadecimal.

D

Returns the human-readable value of an attribute used in the PowerDesigner interface when this value differs from the internal representation.

For example, the value of the Visibility attribute is stored internally as +, but is displayed as public in the property sheet. The template %Visibility% generates as +, but %.D:Visibility% generates as public.
Note: You can access extended attributes defined in another extension file by prefixing them with the .D option (see Extracting Object Properties).

X

Escapes XML forbidden characters.

E

[deprecated – use the ! power evaluation operator instead, see GTL Operators].

Examples
This file is generated for %.UQ:Name%. It has the form of a %.L:Color% %.L:Shape%.
This file is generated for "MYGADGET". It has the form of a red triangle.
The following template is applied to object abcdefghijklmnopqrstuvwxyz
%12.3QMFU:Name%
Result:
"Lmn"