Often data needs to be accessible to several scripts within a window. For example, suppose that a window displays information about one customer. You might want several CommandButtons to manipulate the data, and the script for each button needs to know the customer's ID. There are several ways to accomplish this:
Declare a global variable containing the current customer ID
All scripts in the application have access to this variable.
Declare an instance variable within the window
All scripts for the window and controls in the window have access to this variable.
Declare a shared variable within the window
All scripts for the window and its controls have access to this variable. In addition, all other windows of the same type have access to the same variable.
When declaring a variable, you need to consider what the scope of the variable is. If the variable is meaningful only within a window, declare it as a window-level variable, generally an instance variable. If the variable is meaningful throughout the entire application, make it a global variable.
For a complete description of the types of variables and how to declare them, see the PowerScript Reference in the online Help.