Home » Developer & Programmer » Forms » How to Declare Global Variable and call from one from to another from (D2K Forms 4.5 - oracle 8i)
How to Declare Global Variable and call from one from to another from [message #352091] Mon, 06 October 2008 01:25 Go to next message
PadmajaKumar
Messages: 7
Registered: November 2006
Location: Chennai,India
Junior Member
I want to call a value from one from to another form in d2k forms 4.5. I think this can be done only by declaring a global variable.

I don't know how to declare global variable and also calling the same in other forms.

Kindly help me. I thank you in advance.
Re: How to Declare Global Variable and call from one from to another from [message #352093 is a reply to message #352091] Mon, 06 October 2008 01:31 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Forms 4.5, but - don't they have Help system? More recent versions do, so that you could search for "global variable" by yourself.

Global variables can be declared in to ways: the first one is simple
:global.my_name := 'Littlefoot';
while the other one uses the DEFAULT_VALUE built in:
default_value('Littlefoot', 'global.my_name');

Note that global variables' datatype is always CHARACTER (you can store a string up to 255 characters in length).

How to use it in another form? Just as you'd use any other variable:
message('My name is ' || :global.my_name);
or
l_another_variable := :global.my_name;
etc.
Re: How to Declare Global Variable and call from one from to another from [message #352094 is a reply to message #352093] Mon, 06 October 2008 01:36 Go to previous messageGo to next message
PadmajaKumar
Messages: 7
Registered: November 2006
Location: Chennai,India
Junior Member
Thank you verymuch for your help.
Re: How to Declare Global Variable and call from one from to another from [message #589028 is a reply to message #352091] Mon, 01 July 2013 09:22 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Hi Sir,

I have understood the declaration of global variable from your site. With reference to your earlier post you have stated that we can use the global variable in another form by using the following statement

l_another_variable := :global.my_name;

Now my question if i want use that variable in the property palette of a data block .Then how can i use the variable l_another_variable .

Thanks In Advance,

Regards,

Jay.



Re: How to Declare Global Variable and call from one from to another from [message #589029 is a reply to message #589028] Mon, 01 July 2013 09:25 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
You can't - you need to create a datablock item and use that instead. I did tell you this in your other thread.
Re: How to Declare Global Variable and call from one from to another from [message #589032 is a reply to message #589029] Mon, 01 July 2013 09:52 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
But Sir, if i create a non data text item and assign the value of global variable in when new form instance trigger then use it in data block property palette then
1) if use it like emp=item22 then error:-item22 is not a valid identifier.
2) if use it like emp=:item22 then error:- All variables are not bound.

Please help me out of this issue.

Re: How to Declare Global Variable and call from one from to another from [message #589034 is a reply to message #589032] Mon, 01 July 2013 10:14 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Try this in pre-query:
:<database item in datablock you want to restrict the query by> := global.whatever_its_called;
Re: How to Declare Global Variable and call from one from to another from [message #589039 is a reply to message #589032] Mon, 01 July 2013 10:26 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Sir,

Still not working.
Re: How to Declare Global Variable and call from one from to another from [message #589056 is a reply to message #589039] Mon, 01 July 2013 13:27 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Define not working - are you getting an error? no data?
Re: How to Declare Global Variable and call from one from to another from [message #589057 is a reply to message #589056] Mon, 01 July 2013 13:30 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Still the same old error .
Re: How to Declare Global Variable and call from one from to another from [message #589059 is a reply to message #589057] Mon, 01 July 2013 14:07 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
You were getting two - which one.
Copy and paste the full error message, plus the code you put in pre-query.
Re: How to Declare Global Variable and call from one from to another from [message #589061 is a reply to message #589059] Mon, 01 July 2013 14:17 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
:item24:=:global.u;


error message

Not all variable are bound.
Re: How to Declare Global Variable and call from one from to another from [message #589064 is a reply to message #589061] Mon, 01 July 2013 15:29 Go to previous messageGo to next message
Littlefoot
Messages: 21811
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is there ITEM24 item in your form?
Re: How to Declare Global Variable and call from one from to another from [message #589065 is a reply to message #589064] Mon, 01 July 2013 15:31 Go to previous messageGo to next message
jay_cooldude
Messages: 50
Registered: March 2013
Location: Hyd
Member
Yes Sir, Mr Cookie Monster insisted me to take a non-database item so that i can pass the value of global variable to the item .
Re: How to Declare Global Variable and call from one from to another from [message #589066 is a reply to message #589061] Mon, 01 July 2013 15:44 Go to previous message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
jay_cooldude wrote on Mon, 01 July 2013 20:17
:item24:=:global.u;


error message

Not all variable are bound.


The complete error message - including the select statement.
Previous Topic: Check Box. When multi-record block is unchecked then the Select_ALL checkbox should be unchecked.
Next Topic: browser support
Goto Forum:
  


Current Time: Sat Jun 01 05:22:14 CDT 2024