unique and interseting problem in form [message #85448] |
Mon, 28 June 2004 04:16 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
domingo
Messages: 54 Registered: June 2004
|
Member |
|
|
Hi
I am facing a nice problem.
I have two forms form a , form b.
form a calls form b and passes some value say thru global.x.
form b is queried on the basis of this :global.x and shows the result.
but form b is sometime run independently as well then it shows the message
global.x not declared;
if i declare global.x in form b ,
I am losing the data of global.x when it is being called by form a.
I hope i could make my point clear.
regards
shubhajit.
|
|
|
Re: unique and interseting problem in form [message #85449 is a reply to message #85448] |
Mon, 28 June 2004 05:36 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Himanshu
Messages: 457 Registered: December 2001
|
Senior Member |
|
|
Hi,
Instead of referring to Global variable in Form B, make a local parameter in it.
When you call FormB from FormA then pass the Global parameter as parameter list to the called form.
So,now your FormB can perform X set of actions when called from Form A as it would be not null & can perform different job when called from Menu.
If you want to stick to the same solution which you have implemented then simply declare your Global variable in the Menu item.
Note that this will work only if you are not creating new session when the Form is called from Menu.
HTH
Regards
Himanshu
|
|
|
Re: unique and interseting problem in form [message #85452 is a reply to message #85448] |
Mon, 28 June 2004 20:45 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
krishna kumar shrivas
Messages: 11 Registered: June 2004
|
Junior Member |
|
|
Hello,
For this problom i am giving to you solution but note that this is working only when you are not executeing your in "when-new-form-instance".Define the
on error trigger either at form level or item level check their if errnum is 40815 then,at this sitution declare the global variable and use that.
But best ways is to always pass the parameter from one form to another form is useing the parameter list.use the global variable only when you want to return some valuse to back to the calling form.
ok bey
krishna.
|
|
|
|
Re: unique and interseting problem in form [message #85457 is a reply to message #85455] |
Tue, 29 June 2004 00:40 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
krishna kumar shrivas
Messages: 11 Registered: June 2004
|
Junior Member |
|
|
Put this code into "when-new-form-instance"
message(:global.x);
message(:global.x);
here this variable is not declared if you run the form "B" independtly. ok
Define the On Error Trigger.At form level and put this code thier.
"On-Error" Trigger Code
DECLARE
errnum NUMBER(10) := ERROR_CODE;
errtxt VARCHAR2(500) := ERROR_TEXT;
BEGIN
IF ERRNUM = 40815 THEN
:global.x := 'kk';
message(:global.x);
message(:global.x);
END IF;
END;
ok i think that now you got it.
If you still faceing the problom then mail me.
Good luck
krishna kumar shrivas
bangalore.
And here you declare this variable and assigne some value to this varibale,Default value or null.and then use this in your query statemnt to execute your query.
Put the debuger at "when-new-form-instance" then see what happen.........
|
|
|
Re: unique and interseting problem in form [message #85498 is a reply to message #85448] |
Fri, 02 July 2004 04:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/45399.jpg) |
vamsi kasina
Messages: 2112 Registered: October 2003 Location: Cincinnati, OH
|
Senior Member |
|
|
you can do it this way.
use Default_Value(value,variable);
value - varchar2 - what ever value to be assigned to the gloabl variable if it is null
variable - varchar2 - global variable name
ex:
Default_Value('FRANCE','GLOBAL.country');
if you intialize the global variable the default_value statement do nothing.
if you didn't initialize the global variable the dafault_value initializes the global variable to whatever value specified there.
by
vamsi
|
|
|