Chapter 9 Generation Reference Guide (GTL)


Operators

The following operators are supported in GTL:

Dereferencing operator

The syntax ['*']+ <local-value> ['('<parameter-list>')'] returns the object member defined by the evaluation of ['*']+ <local-value>. If the given object member happens to be a template, a parameter list may be specified. Applying the star operator corresponds to a double evaluation (the * operator acts as a dereferencing operator).

Suppose a local variable is defined as: .set_value(C, Code)

Then %C% will return "Code" and %*C% will return the result of the evaluation of %Code%. In other words, %*C% can be thought of as %(%C%)% (the latter syntax being invalid).

! power evaluation operator

Evaluates the results of the evaluation of the variable as a template.

For example, you define a comment containing a variable like %Code%. When you use the ! operator in %!Comment% , the actual value of %Code% is substituted for the variable block. Without the ! operator, the variable remains unevaluated.

The ! operator may be applied any number of times. For example:

%!!template%

This outputs the results of the evaluation of the evaluation of the evaluation of template 'template'

? operator

The ? operator is used to test the existence of a template, a local variable, a volatile or an extended attribute. It returns "true" if the variable exists, "false" otherwise.

Example:

Template

.set_value(foo, tt)
%custname?%
%custid?%

outputs:

true
false

as custname is defined whereas custid is not.

+ operator

The + operator is used to test if an object property is visible in the interface.

Example:

You can test if the Type box is displayed in the General tab of a database property sheet in the Information Liquidity Model, this indicates if the Replication Server or MobiLink extended model definitions are attached to the current model.

You have to define the %Database.Type+% template, it will output false if no extended model definition is associated with the current model.

 


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