Formatting Options

You can change the formatting of variables by embedding formatting options in variable syntax.

%[[-][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.

X

Escapes XML forbidden characters.

E

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

You can combine format codes. For example, the template (%12.3QMFU:Name%) applied to object abcdefghijklmnopqrstuvwxyz generates ("Lmn").