Chapter 9 Generation Reference Guide (GTL)


Defining variable formatting options

Variables have a syntax that can force a format on their values. Typical uses are as follows:

You embed formatting options in variable syntax as follows:

%.format:variable%

The variable formatting options are the following:

Format option Description
n (where n is an integer) Extracts the first n characters. Blanks or zeros added to the left to fill the width and justify the output to the right
-n Extracts the last n characters. Blanks or zeros added to the right to fill the width and justify the output to the left
L Converts to lowercase characters
U Converts to uppercase characters
c Upper-case first letter and lower-case next letters
A Automatically removes indentation and aligns text on the left border
D Gives access to the human-readable value of an attribute (as it is displayed in the product interface) when this actual value differs from the internal representation of this attribute. In the following example, 'public' is the visibility as it is shown in the product interface, whereas it is stored as '+' in the model.
%Visibility% = +
%.D:Visibility% = public
F Combined with L and U, applies conversion on the first character
T Leading and trailing white space trimmed from the variable
q Enquotes the variable with single quotes
Q Enquotes the variable with double quotes
X Escapes XML forbidden characters
E Forces the evaluation of templates defined within object properties.

For example, you define a comment containing a variable like %Code%. When you use the E formatting option in %.E:Comment% , the actual value of %Code% is generated in the file. Without the E option, the variable remains not valuated

You can combine format codes. For example, %.U8:CHILD% formats the first eight characters of the code of the CHILD table in uppercase letters.

 


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