Chapter 5 Customizing Generation with GTL


.set_object and .set_value macros

These macros are used to define a local variable of object (local object) or value type.

.set_object ( [scope.] name [,object-ref [,mode]])

The variable is a reference to the object specified using the second argument.

.set_value ( [scope.] name, value [,mode])

The variable value is set to be the translated template value specified as the second argument.

The following parameters are available:

Parameter Description
scope [optional] Qualifying scope.

Type: Simple-template returning an object or a collection scope
name Variable name

Type: Simple-template
object-ref [.set_object only] [optional] Describes an object reference. If it is not specified or is an empty string, the variable is a reference to the active object in the current translation scope

Type: [scope.]object-scope]
value [.set_value only] Value.

Type: Simple template (escape sequences ignored)
mode [optional] Specifies the mode of creation. You can choose between:

  • new - (Re)define the variable in the current scope
  • update – [default] If a variable with the same name already exists, update the existing variable otherwise define a new one
  • newifundef - Define the variable in the current scope if it has not been defined in an outer scope, otherwise do nothing

Example:

.set_object(Attribute1, Attributes.First)

Example:

.set_value(FirstAttributeCode, %Attributes.First.Code%)

Note   Note
When specifying a new variable, it is recommended to specify 'new' as third argument to ensure that a new variable is created in the current scope.

 


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