Home » Developer & Programmer » Forms » Saving problem while moving from database block to non database block (Oracle Forms 6i)
Saving problem while moving from database block to non database block [message #604156] Wed, 25 December 2013 05:37 Go to next message
yesh
Messages: 15
Registered: November 2013
Junior Member
Hi all,
I have a non database and database block.
while in database block if i make any changes, changes should be saved before moving to non database block.
I wrote the following code in Post-Block trigger but it is not working

IF :SYSTEM.BLOCK_STATUS <>'QUERY' THEN
STD_ERROR_ROUTINE(90250,:GLOBAL.M_LANG_CODE,NULL,NULL,NULL,NULL,NULL,'FP');
END IF;

Can anyone please tell how to solve this situation.
Image is attached.
Re: Saving problem while moving from database block to non database block [message #604159 is a reply to message #604156] Wed, 25 December 2013 06:31 Go to previous messageGo to next message
Littlefoot
Messages: 21809
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What does it mean that this code "is not working"? Does POST-BLOCK trigger fire? Is STD_ERROR_ROUTINE executed? Do you get any error? If so, which one?
Re: Saving problem while moving from database block to non database block [message #604160 is a reply to message #604159] Wed, 25 December 2013 06:52 Go to previous messageGo to next message
yesh
Messages: 15
Registered: November 2013
Junior Member
POST-BLOCK fired. STD_ERROR_ROUTINE executed. but here the problem is while navigating to the non database block i should save my database block(if any changes are made).
But Post-Block is firing when i try to save. while trying to save POST-BLOCK shouldn't fire if my understanding is correct

[Updated on: Wed, 25 December 2013 06:53]

Report message to a moderator

Re: Saving problem while moving from database block to non database block [message #604163 is a reply to message #604160] Wed, 25 December 2013 07:25 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
try to use


   IF :SYSTEM.BLOCK_STATUS = 'CHANGED' THEN
  ------your detail here
   commit;
   END;


For Example

DECLARE
   ABC VARCHAR2(25);
BEGIN
   SELECT NAME INTO ABC FROM OWNER WHERE ID = :ID;
   IF :SYSTEM.BLOCK_STATUS = 'CHANGED' THEN
      INSERT INTO PREV_OWN VALUES (:ID,ABC,SYSDATE);
   END IF;
   COMMIT;
END;



Regard
Mughal

[Updated on: Wed, 25 December 2013 07:26]

Report message to a moderator

Re: Saving problem while moving from database block to non database block [message #604168 is a reply to message #604163] Wed, 25 December 2013 07:34 Go to previous messageGo to next message
yesh
Messages: 15
Registered: November 2013
Junior Member
Thank you.But i don't want to insert like that.i have a SAVE button to do that. I just want to throw error when any changes are made and the control is leaving the database block without the changes being saved. What happens here is when i try to save Post-Block fires stopping the save from being made.
Re: Saving problem while moving from database block to non database block [message #604169 is a reply to message #604168] Wed, 25 December 2013 07:43 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
ok without saving above code will saved if you made any changes anyway can you plain about your non-database block items i mean ARE you using TAB "CANVASES"

[Updated on: Wed, 25 December 2013 07:51]

Report message to a moderator

Re: Saving problem while moving from database block to non database block [message #604170 is a reply to message #604156] Wed, 25 December 2013 07:55 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
yesh wrote on Wed, 25 December 2013 05:37
Hi all,

I have a non database and database block.
while in database block if i make any changes, changes should be saved before moving to non database block.



Can you explain this question


Regard
mughal

[Updated on: Wed, 25 December 2013 07:56]

Report message to a moderator

Re: Saving problem while moving from database block to non database block [message #604171 is a reply to message #604170] Wed, 25 December 2013 08:10 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
ok i got your question now please explain your non-database block detail and whether it si TAB Canvases or not


Regard
Mughal
Re: Saving problem while moving from database block to non database block [message #604174 is a reply to message #604171] Wed, 25 December 2013 08:38 Go to previous messageGo to next message
yesh
Messages: 15
Registered: November 2013
Junior Member
Not a TAB canvas
Re: Saving problem while moving from database block to non database block [message #604175 is a reply to message #604174] Wed, 25 December 2013 08:53 Go to previous messageGo to next message
Littlefoot
Messages: 21809
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I can't try it myself, so you'll have to do that. Create a WHEN-NEW-RECORD-INSTANCE trigger on the control (non-database) block. In it, check database block's status (use GET_BLOCK_PROPERTY). If its status is such that you'd want to save those changes, COMMIT. Otherwise, don't do anything.

yesh

while trying to save POST-BLOCK shouldn't fire if my understanding is correct

If you were on Forms 10g, you could have used its debugger. On Forms 6i, you'll have to do that manually: put a MESSAGE call into every trigger you have (as its very first command). Run the form, do whatever you do. MESSAGE will tell you which triggers are firing. Don't be surprised when POST-BLOCK fires, although you don't expect it to. Numerous triggers fire in respond to your actions, not only the ones you think they should.
Re: Saving problem while moving from database block to non database block [message #604176 is a reply to message #604175] Wed, 25 December 2013 08:58 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
great suggested by @littlefoot you also try to do this

just check that mouse navigate property of the button is set properly.

i think this will solve the problem.
Re: Saving problem while moving from database block to non database block [message #604178 is a reply to message #604175] Wed, 25 December 2013 09:22 Go to previous messageGo to next message
yesh
Messages: 15
Registered: November 2013
Junior Member
Thank you.I ll Try and get back.
Re: Saving problem while moving from database block to non database block [message #604183 is a reply to message #604178] Wed, 25 December 2013 12:47 Go to previous message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
OR

you can save your record in this way also


--------------WHEN-BUTTON-PRESSED---------

IF :System.Form_Status = 'CHANGED' THEN
 commit_form;
 IF :System.Form_Status <> 'QUERY' THEN
      Message('An error prevented your changes from being submitted.');
      Bell;
      RAISE Form_Trigger_Failure;
    END IF;
go_block('control');
end if;


Regard
Mughal


Previous Topic: SET_ITEM_PROPERTY('DYNAMIC ITEM ID',PROPERTY,VALUE)
Next Topic: inserton problem.
Goto Forum:
  


Current Time: Fri May 17 00:11:23 CDT 2024