Defining global variables and subprograms

About this task

The Programmer's pane contains a placeholder on the Objects tab called (Globals) that allows you to define global variables and subprograms using LotusScript. To define a global variable or subprogram perform these steps:

Procedure

  1. Click (Globals) on the Objects tab.
  2. Select (Options), (Declarations), Initialize, or Terminate from the Objects tab.
  3. Enter your LotusScript variable or subroutine in the Script area.
  4. Refer to the subprogram or variable in any script in the application.

Results

Note: There is no such thing as a global variable accessible from all scripts in a database. The scope of a global variable extends only to the window in which it is declared. For example, if the global variable or subroutine is declared on a form, then all scripts on that form may refer to that global variable. Each new document window will have a new copy of the global variable. Different documents windows opened at the same time, or even the same document opened a second time, do not use the same variable storage. Different scripts that share the same script library, do not share the global variable storage of the script library. Each script loads a separate copy of the library and its variables. If you need to retain a value for longer than a form or view window remains open, or use it from multiple windows within the application, you must store the value somewhere, for example, in a profile document or regular document field, or in an environment variable.