In spite of 'Global variable's downsides, in some cases, it is still a good alternative solution .
'Global variables' are initialized once to hold e.g. user's name value and it persists or lasts with you till the form's end of session.
No 'Global variable' downloads can exist that may affect your application in terms of system efficiency and resources.
On the other hand, you should also recognize alternatives e.g. getting user names, has another alternative you can use as follow:
Two methods with one output:
If you know there are two ways to get your out put then you should learn why you have to choose then decide what to choose. This depends upon specific system criteria as follow:
why to choose vs. what to choose...?
Globals are usually intialized in One main form that holds valuable and popular data that are commonly used, e.g. user names, financial year and the company's branch or the location_id.
It is recommended to use either PRE-FORM or WHEN-NEW-FORM-INSTANCE form level triggers.
U can use any technique to initialize 'Global variables' .
Passing Globals from main login form to other applications
Each sub-main form can receive the Globals from the main application login form either by assigning the Globals to the local parameters form or by directly reference to Globals by Global's names.
it is strongly recommended to destroy 'Global variables' at the moment you don't need anymore.
The question is... where to erase it...?
In your main application login-form.
The question is... when to erase it...?
U can use key-exit or when-window closed form-level triggers.
The question is... how to erase it...?
U can use Erase built-in.