Bottom of Page | Previous Page | Next Page | Contents

Interacting with global variables

A global variable contains a value that can be used to pass information from one HATS object to another. For example, you can extract information from several locations on a host screen, perform calculations, and insert the result on the current screen or a future one. You can build up an array of strings from one or more host screens and insert them into a transformation. You can extract a string that a user enters into a field on a Web page and use it elsewhere.

Global variables exist for the time that the HATS application is active. If several users open host sessions using the same HATS application, the global variables for each session are used only in that session; they are not shared between different sessions using the same HATS application. A global variable can contain a numeric value, a string, or an indexed array of strings. If you use a global variable to contain an array of strings, you can specify for any action whether you want to use the entire array, a particular index, or all the values starting at a particular index. All operations on global variables are case-sensitive. Do not use names beginning with "HATS" for global variables.

You can set the value of a global variable in these ways:

After a global variable has a value, you can use that value in the following ways:

If you insert a global variable into a host screen, you must list this action before applying a transformation, so that the global variable will appear on the Web page created from the host screen. See Actions tab for more information about specifying actions for screen customizations. For information on inserting global variables into transformations and templates, refer to Insert Global Variable wizard.

Global variables can be used with prompt and extract macros to either provide a value for a prompt or to store a value extracted from the host screen. See Incorporating macros for more information about using global variables with macros.

To use global variables in business logic, you must check the Get global variable box in the Create Business Logic wizard. This creates a stub in your business logic code to give you access to HATS global variables. See Adding business logic for more information about using business logic.

If you want to use a global variable to accumulate strings or a numeric value from several screens, you can initialize it by adding a Set global variable action to the connect event. From the HATS Project View tab of the HATS Studio, click the Navigator tab at the bottom, expand your project, and expand the source/profiles/events/session/main directory. Double-click connect.evnt to customize the connect event.

[ Top of Page | Previous Page | Next Page ]