Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 7 Working With Variables : Global Variables

Global Variables
Global variables provide an easy way to set defaults for use throughout your project. There are several ways in which they can be used:
You can also override values for predefined variables, unless the GUI does not allow you to make them settable later.
For example, you could assign the value 7474 to the predefined global variable RvDaemon. You can then use the variable in different sessions in your adapter. If you wish to change the TIBCO Rendezvous daemon for your adapter, you can globally set it to a different value or override it from the command line.
When you want to use the global variable in the fields of a resource, enter the variable name surrounded by %% on both sides. Some fields in the configuration panel, such as user name and password fields, allow you to drag and drop global variables into the field.
When the project is deployed and the configured components run, all occurrences of the global variable name are replaced with the global variable value. For example, a global variable named RvServiceTest with a value of 7800 would be replaced with 7800.
Global Variables Editor
Use the global variables editor to create or modify global variables, mark variables as settable from TIBCO Administrator, and assign a type to a variable.
To display the global variables editor, in the project panel, select the Global Variables tab or drop down, then click the Open Advanced Editor (pen) icon. If you select a global variable, then click the pen icon, the editor opens with the variable selected.
Figure 22 shows the global variables editor.
Figure 22 The global variable editor
Adding a Global Variable or Global Variable Group
To add a global variable, select the create variable icon. A new line for the variable appears. Type a name for the variable by triple-clicking the name field.
The name MessageEncoding is reserved and cannot be used to name a global variable. A global variable of this name is created by Designer when generating an EAR file.
When creating a global variable group or variable, it is added to the bottom of the list. When you reopen the global variables editor, the group or variable displays alphabetically in the list.
Global variable groups are used for organizing variables. Variable groups are especially useful if multiple developers share a project using a version control system. To add a global variable group, select the add variable group icon.
Using a Filter
By default, all global variables are visible in the editor. You can provide a filter in the Filter string/pattern field to limit the display. The filter uses regular expression matching. That is, if you enter Rv in the field, only variables that have Rv in their name are displayed. Matching is case insensitive. Entering a new expression and clicking Filter again performs a new search on all variables and will not refine the current search.
To clear the filter expression and display all variables either click Show all or remove the expression from the entry box and click Filter again.
Global Variable Attributes
To add or edit a name, value, constraint or description attribute, triple-click in the attribute field. The type attribute has a drop down menu that displays choices. Click in the type field to display the menu.
Service — Indicates that the variable should be included when the Include all service level global variables option is selected when building the enterprise archive file. A variable can be set on a per-service basis.This option is used for TIBCO adapter archives and TIBCO ActiveMatrix BusinessWorks.
Constraint — For String and Integer types, provide a range of allowed values. The constraint field for Strings is an enumeration, for example, one, two, three. The constraint field for Integers is for a range, for example, 1-100. Note that constraints are currently not implemented in TIBCO Administrator.
Deleting a Global Variable
Delete a global variable by selecting it and clicking the delete variable icon. You cannot delete a global variable that is in use. To find where global variables are used, click Tools > Find Global Variable Usages.
Changing Global Variable Values at Runtime
You can change the value of a global variable when you deploy your project in TIBCO Administrator. See the section on modifying runtime variables in TIBCO ActiveMatrix BusinessWorks Administration for more information on using TIBCO Administrator.
You can also specify values for global variables when starting a process engine on the command line. To do this, specify the following as a command line argument when starting the process engine:
 
-tibco.clientVar.<variablePathAndName> <value>
where variablePathAndName is the name of the variable you wish to set, including the path to the variable if it is contained in a folder. value is the value you wish to set the variable to. For example, if you have a global variable named item1 contained in a folder named myGroup and you wish to set its value to 500, add the following argument to the command line when starting the process engine:
 
-tibco.clientVar.myGroup/item1 500

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved