fileglobal
VARIABLES

The fileglobal statement creates one or more fileglobal variables.


Parameters

This statement has one parameter:

variables – is a list of variables to be created. Each variable should be separated from the next by a comma. If a variable name contains spaces or punctuation it should be surrounded by chevron (« ») characters.


Description

The fileglobal statement creates one or more global variables that are specific to the current database. File global variables may be used by any procedure as long as the same database is open, and remain active until you close the database.

The fileglobal statement reduces that chance for conflict between databases. If two different databases define a global variable with the same name, they can conflict with each other. (On the other hand, the two databases can also use the global variable to communicate with each other.)

Fileglobal variables are not shared between databases. If two different databases have fileglobal variables with the same name, they will not conflict with each other. In fact, Panorama will keep two separate variables…one for each database. When you are using the fileglobal statement you don’t have to worry about whether your variable names conflict with variables in any other database. (You do still need to worry about conflicts with field names, however. You should not define a fileglobal variable with the same name as one of the fields in your database.)

Globals vs. File Globals

Since using fileglobal eliminates conflicts, why would you ever use the global statement to define variables? Most of the time you would not, and you may want to review your existing databases and change most or all of the global statements to fileglobals. However, there are two cases where you may want to continue to use global variables.

If you need to share data between multiple databases, a global variable may be the way to go. (However, it is also possible to access fileglobal variables from another file using the fileglobalvalue( function.)

If you need the variable to remain even after the database is closed, use a global variable. Global variables remain active until you quit from Panorama. Variables created with fileglobal disappear when the file is closed.

The example creates two fileglobal variables, Channel and Home Timeouts.

fileglobal Channel, «Home Timeouts»

You may change the value of a variable with an assignment, like this:

«Home Timeouts»=«Home Timeouts»-1

However, if you switch to another database, the fileglobal variables can no longer be accessed.

window "New Zealand" // switch to another db
Channel=7 // this will produce a runtime error!

Note: If you need to get the value of a fileglobal variable in another database you can use the fileglobalvalue( function.


See Also


History

VersionStatusNotes
10.0No ChangeCarried over from Panorama 6.0