Solved

form close command

Posted on 2014-03-22
17
955 Views
Last Modified: 2014-03-27
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
Comment
Question by:NiceMan331
  • 9
  • 8
17 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 39947512
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
 

Author Comment

by:NiceMan331
ID: 39948257
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
 
LVL 20

Expert Comment

by:flow01
ID: 39949115
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
 

Author Comment

by:NiceMan331
ID: 39949542
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
 

Author Comment

by:NiceMan331
ID: 39949588
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
 
LVL 20

Expert Comment

by:flow01
ID: 39950921
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
 

Author Comment

by:NiceMan331
ID: 39952427
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
 
LVL 20

Accepted Solution

by:
flow01 earned 500 total points
ID: 39954790
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:NiceMan331
ID: 39955162
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
 
LVL 20

Expert Comment

by:flow01
ID: 39955379
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
 

Author Comment

by:NiceMan331
ID: 39955732
ok
i removed the exit_from trigger
i put it under when_button_pressed
but no response at all
0
 
LVL 20

Expert Comment

by:flow01
ID: 39956269
???
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
 

Author Comment

by:NiceMan331
ID: 39957487
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
 
LVL 20

Expert Comment

by:flow01
ID: 39957611
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
 

Author Comment

by:NiceMan331
ID: 39958138
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
 
LVL 20

Expert Comment

by:flow01
ID: 39959857
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
 

Author Comment

by:NiceMan331
ID: 39959897
yes
now every thing is ok
thanx
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now