Chapter 5 Customizing Generation with GTL


.vbscript macro

The vbscript macro is used to embed VB script code inside a template. It is a block macro.

A vbscript macro has the following syntax:

.vbscript [(script-param-list)]
	block-input
.endvbscript [(tail)]

The output is the ScriptResultArray value.

The following parameters are available:

Parameter Description
script-param-list Parameters that are passed onto the script through the ScriptInputArray table.

Type: List of simple-template arguments separated by commas
block-input VB script text

Type: Text
tail Appended to the output, if there is one

Type: Text

Example:

.vbscript(hello, world)
ScriptResult = ScriptInputArray(0) + " " + ScriptInputArray(1)
.endvbscript

The output is:

hello world

Note: the active object of the current translation scope can be accessed through the ActiveSelection collection (see "Global properties" in the Scripting PowerDesigner chapter) as ActiveSelection.Item(0).

 


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