Home » Developer & Programmer » Forms » Declare Global variables
Declare Global variables [message #238758] Sat, 19 May 2007 17:00 Go to next message
dryinego
Messages: 16
Registered: May 2007
Junior Member
Hi,
Can you tell me how to declare and use global variables.
Thanks
Re: Declare Global variables [message #238819 is a reply to message #238758] Sun, 20 May 2007 03:31 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is there a reason why you don't want to read about global variables in always accessible Forms Online Help system? While in Forms Builder, select "Help - Online Help ..." menu and search for any term you'd want to know more about.

Global variables can be declared in several ways; one of them is usual
:global.my_var_1 := 'abc';
. Another one is using the DEFAULT_VALUE built-in:
DEFAULT_VALUE('1234', 'global.my_var_2');


Note that global variables are always of a CHARACTER data type; you can store numbers into them, but then don't forget to use the TO_NUMBER function if necessary.

Reference them by preceding their name with a colon and the 'global' keyword, such as
IF :global.student_id = 'MV332' THEN ...
Referencing a non-initialized global variable causes an error.

Delete their value using the ERASE built-in:
ERASE('global.my_var_1');
This is necessary if you don't want to accidentally use its value (because global variable holds its value during the whole session, so you can use it in all forms/reports during that session).
Re: Declare Global variables [message #238853 is a reply to message #238819] Sun, 20 May 2007 10:13 Go to previous message
dryinego
Messages: 16
Registered: May 2007
Junior Member
Okie ...Thanks a ton...

Previous Topic: How can we get data from One Form to Another Form
Next Topic: Need Help! am Newbie but not that new & Need urgent help regarding ifweb90.exe (merged again
Goto Forum:
  


Current Time: Fri Sep 27 00:18:51 CDT 2024