• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1222
  • Last Modified:

form close command

dear
i have one form open on query mode ,
first field name ,   entry_no ,  is required
when post its value , it will query data from other oracle user , then i save it in another button
here is the original post
http://www.experts-exchange.com/Database/Oracle/Q_28091342.html
now i used to create closing button
close_form('JOURNAL');

Open in new window

when the cursor on query mode and on the entry_no field , closing not perfumed
because it stand on required filed

what i should do to let closing form works when it is on query mode and on required filed
0
NiceMan331
Asked:
NiceMan331
  • 9
  • 8
1 Solution
 
flow01Commented:
Yes, oracle didn't provide a nice solution for this. so you will have to do it your self.

steps
1 change the button trigger
  if :system.form_status = 'QUERY'  then
       create a non repeating timer  'CLOSEFORM_IN_QUERYMODE'  with a small waiting time
       exit_form;  -- to leave the enter-query  mode
       message(' 'you will not see this message because trigger action stops after exit_form', acknowledge);
   else
       close the form
    end if;

2 create or change the when_timer_expired trigger to perform the actions if the timer
   'CLOSEFORM_IN_QUERYMODE' expires
    since this trigger gets active after  the trigger in step 1 has ended you are
 not in query mode anymore:
    you can now execute the close_form with succes
0
 
NiceMan331Author Commented:
i changed button trigger like this

declare
	timer_id Timer; 
immediate NUMBER(5) := 5;
BEGIN
  
if :system.form_status = 'QUERY'  then

        timer_id := CREATE_TIMER('CLOSEFORM_IN_QUERYMODE', immediate, NO_REPEAT);  
       exit_form;  
      
   else
       close_form('JOURNAL');
   end if;
   end;

Open in new window

then , when timer expired
BEGIN
  IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'CHANGE_LABEL' THEN
     Set_Item_Property('NORM.CH_MODE', LABEL, Name_In('System.Mode'));
     
  else  IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'CLOSEFORM_IN_QUERYMODE' THEN
  	
  	close_form('JOURNAL');
 ELSE
     NULL; --
 END IF;
 end if;
END;

Open in new window


i changed the imiddiate from 1,2,5 and 10 , but still the action not performed
0
 
flow01Commented:
The code changes look fine.
Is the form after pressing the button still in enterquerymode ?  
Is there a way to  simulate the close-proces without using the button:  is there an exit-option available for example in the menu.  If you use it do you leave enterquerymode then.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
NiceMan331Author Commented:
Is the form after pressing the button still in enterquerymode ?  
yes

Is there a way to  simulate the close-proces without using the button:  is there an exit-option available for example in the menu.  If you use it do you leave enterquerymode then.

yes , when i return back of bulit_in close option of the window , it close it by two steps
first press it cancel the query , next press it send oracle form message "close_the form"
by selecting yes it closed
0
 
NiceMan331Author Commented:
i also surprise for one more thing
in same form , i have 2 buttons , one to run report , and the other to open another form
the report opening without any problem , while the form not , same as close button
0
 
flow01Commented:
Ok , if the cancel does leave the enter querymode,  exit_form should do the same.
Is a key-exit  trigger defined ?
If yes please provide the code it contains,
if no change  to debug


declare
      timer_id Timer;
immediate NUMBER(5) := 5;
BEGIN
message('form_status:' ||   :system.form_status, acknowledge);

if :system.form_status = 'QUERY'  then
message('before create timer', acknowledge);

        timer_id := CREATE_TIMER('CLOSEFORM_IN_QUERYMODE', immediate, NO_REPEAT);  
if form_success then
message('after create timer success' , acknowledge);
else
message('after create timer failure', acknowledge);
end if;
message('before exit_form', acknowledge);
       exit_form;  
message('after exit_form', acknowledge);
   else
       close_form('JOURNAL');
   end if;
   end;
0
 
NiceMan331Author Commented:
ok , now it refuse to close even in the built in close
it sent those message

form_status : NEW
frm - 41361 : cannot navigate out of current form in Enter_Query mode

but when i cancel the query by changing form mode , the form close using the built in close sending message
form status : changed
then close

here i'm surprise , because the form opened in new , then it changed to query by this code
on when_new-form_instance

begin
	 start_change_label; 


IF :SYSTEM.mode = 'NORMAL'THEN 

	ENTER_QUERY;

ELSE 

	EXECUTE_QUERY;

END IF;
  

end;

Open in new window



anyhow , i changed the following in your code
key_exit
instead of :
if :system.form_status = 'QUERY'  then
	if :system.form_status = 'NEW'  then

Open in new window

here it gives those results :

form_status NEW
BEFORE CREATE TIMER
after create timer sucess
before exit form
after exit form
then it closed


the button still not respond to close in any of above status
0
 
flow01Commented:
1  and the button did not display any of the messages ?

2 Sorry , I suggested the wrong :system.variable
It should have been
IF :system.mode = 'ENTER-QUERY'
but I would have expected that the "after exit form message" was not shown, try the following.

declare
      timer_id Timer;
immediate NUMBER(5) := 5;
BEGIN
message('mode:' ||   :system.mode, acknowledge);

IF :system.mode = 'ENTER-QUERY'   then
message('before create timer', acknowledge);

        timer_id := CREATE_TIMER('CLOSEFORM_IN_QUERYMODE', immediate, NO_REPEAT);  
if form_success then
message('after create timer success' , acknowledge);
else
message('after create timer failure', acknowledge);
end if;
message('before exit_form', acknowledge);
       exit_form;  
message('after exit_form', acknowledge);
message('mode:' ||   :system.mode, acknowledge);      
       close_form('JOURNAL');
   else
       close_form('JOURNAL');
   end if;
   end;
0
 
NiceMan331Author Commented:
1  and the button did not display any of the messages ?
no

2- the messages on : key_exit are :
mode ENTER-QUERY
before create timer
after create timer success
before exit form
query cancelled
after exit form
mode NORMAL
then closed
0
 
flow01Commented:
I think I see the misunderstanding:
I assume you put the code in the exit-form trigger  and not in the when button pressed trigger,  because i asked if there existed an exit-form trigger.
That was to check if extra actiona are needed when leaving the form , if it was not there before you don't  need it now either.
In that previous post "if no change  to debug" should have been
 "if no change  when button pressed to debug"

So if my assumption is correct:
Put the code in the when button pressed-trigger.
And remove the exit-form trigger (if it did not exist before).

----
Please report back because if you still find the "after exit form" then the timer is probably not needed. (and that differs from the behaviour i am familiar with).
0
 
NiceMan331Author Commented:
ok
i removed the exit_from trigger
i put it under when_button_pressed
but no response at all
0
 
flow01Commented:
???
save the existing code somewhere
and
change it to

message('the button was pressed' , acknowledge);


if it doesn't show up : was the button enabled ?
change the label of the button to verify you are changing the wright button
0
 
NiceMan331Author Commented:
i got the reason
the button was in non database block , where i put all buttons there
i shift it to the master block , it works well , it closed
fine
remaining two simple things :
1- before it close , it sent me message : query cancelled , then closed
i want to avoid this message
2- the code works only in enter-query mode , it is correct as per my original request
but sorry , when i tried any button , the mode become normal , and the closing button not works here , it stand on the first required field asking to fill it
ok , i have another button "non databse block"  to change mode , if i change the mode to enter-query , then
the close button works again to  close

i changed the code like this in purpose to change the mode to enter-query , but it not work if the mode is normal
when timer expired
IF GET_APPLICATION_PROPERTY(TIMER_NAME) = 'CLOSEFORM_IN_QUERYMODE' THEN
  
BEGIN
	IF :SYSTEM.mode = 'NORMAL'THEN
message('mode:' ||   :system.mode, acknowledge);

	clear_record;
	clear_block;
                                                                                  	
	ENTER_QUERY;
END IF;

       
       exit_form;  
      
       close_form('JOURNAL');
end;

Open in new window

0
 
flow01Commented:
1. In Normal mode there is   no timer created  so it is not usefull  to make changes for that mode in the when timer expired trigger.
  change the when button-pressed trigger to do the clear before the close_form in the else branch (you probably only need the clear_block).
2, If in enter-query mode you get the  "after exit form" message , remove the creation of the timer: if the trigger continues after the exit_form (leaving the enter-query mode) the timer is not necessary .
3. In  the enter-query branch adjust temporary the message level
:system.message_level := 5;  -- (or 10,15 if the message is not supressed)
exit_form;
:system.message_level := 0;  -- all messages back to normal
0
 
NiceMan331Author Commented:
ok , now the message disappear
still i have problem when normal mode
i did many changes without any response
here is my last changes to : when button pressed
declare
      timer_id Timer;
immediate NUMBER(5) := 5;
BEGIN
message('mode:' ||   :system.mode, acknowledge);

IF :system.mode = 'ENTER-QUERY'   then


:system.message_level := 10;  -- (or 10,15 if the message is not supressed) 
exit_form;
:system.message_level := 0;  -- all messages back to normal
    
       close_form('JOURNAL');
else

	clear_block;

       close_form('JOURNAL');
   end if;
   end;

Open in new window


even it not showing the message of system mode
even i put creating timer on after else , but no response , it just asking L field must be entered
finally , it is not a big issue for me , i can use the other button : switching mode the pressing close button it will be ok , but if done in one button it will be so great
thanx in advance
0
 
flow01Commented:
Is the block of the L-field the same as the block the button is on ?
If not  try setting both properties of the button
mouse navigation and key navigation to 'no' : you can still press the button, but the current block  will not be left.
does the message appear now ?
If the clear_block still  fails, try clear_form .
0
 
NiceMan331Author Commented:
yes
now every thing is ok
thanx
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now