Home » Developer & Programmer » Forms » Have Dept and Emp block on form need to delete record on master  () 1 Vote
icon5.gif  Have Dept and Emp block on form need to delete record on master [message #213061] Tue, 09 January 2007 04:57 Go to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
Dear reader,
hi

I have 2 blocks DEPT(Parent) and EMP(child). Now after execute query on Master block that is DEPT. I navigate to child block EMP and do some changes in the record.

Now without saving I navigate to Master and try to issue Delete Record. Forms show an alert "Do you want to save changes".

Here I dont want forms to ask user do you want to save the changes b/c he/she is deleting master which means child block's changes are no longer use full.

Plz keep in mind that my I m sending you a example. I have more than one master and details. So I need a generic solution.

Regards,
Azam Khan
Re: Have Dept and Emp block on form need to delete record on master [message #213454 is a reply to message #213061] Wed, 10 January 2007 18:00 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
There are similar questions to this in the top couple of pages of threads in this forum so you may wish to search for the text of the save message to find them.

You have a few options - either suppress the message by using message_level=25 or test to see if there have been any changes made to the 'child' block and, if found, clear them (clear_block(no_validate)) or just do the 'clear_block' anyway.

What do you want done with the 'child' records when you delete the 'parent' record? Consider asking the user for verification that the 'parent' record is to be deleted in the pre-delete trigger and if confirmed then do a manual delete of the 'child' records.

David
icon11.gif  Re: Have Dept and Emp block on form need to delete record on master [message #213492 is a reply to message #213061] Thu, 11 January 2007 00:30 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
Dear David,

First Thanks for your reply.

Dear David I have the same solution that you have suggested. But this will involve navigation. I told in my previous post that I have more than one master and detail blocks. I m also doing some validation checks on POST RECORD trigger. This clear block logic will involve navigation from block to block depending on the number of child blocks. And David I think form start to do funny thinks if you do too much progarmatic navigations. Well may be I m wrong but this what I have experienced.

And the other suggestion that you have told me about setting the message_level = 25 that I already tried but this is not working that alert is any ways displaying by the form.

You also asked me what I will do to the child blocks on deletion of master. Well David I m deleting the childs as master is deleted that is done automatically by the form b/c I have used cacase deletion option. As master delete's I also archived the records of master and it's child.

Again thanks for your reply. Takecare. Bye

Regards,
Azam Khan

[Updated on: Thu, 11 January 2007 00:32]

Report message to a moderator

Re: Have Dept and Emp block on form need to delete record on master [message #213672 is a reply to message #213492] Thu, 11 January 2007 16:19 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What navigation? The user pressed 'delete' on the 'parent' block, in tyhe 'delete' trigger of the 'parent' block you test the status of the 'child' block and if it is 'changed' then you do a 'clear_block(no_validate))' on the 'child'. You do not have to navigate to a block to either test its status or clear it.

David
icon5.gif  Re: Have Dept and Emp block on form need to delete record on master [message #214067 is a reply to message #213672] Sun, 14 January 2007 12:38 Go to previous messageGo to next message
azamkhan
Messages: 548
Registered: August 2005
Senior Member
Dear David,

You said, "test the status of the 'child' block and if it is 'changed' then you do a 'clear_block(no_validate))' on the 'child'. You do not have to navigate to a block to either test its status or clear it."

David can you plz tell me how I will clear a block by issuing CLEAR_BLOCK(NO_VALIDATE) without navigating it?

Regards,
Azam Khan
Re: Have Dept and Emp block on form need to delete record on master [message #214340 is a reply to message #214067] Mon, 15 January 2007 23:40 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
My sincere apologies, I thought that it was possible to specify the block name as part of the command.

As the 'delete_record' command is defined for 'restricted procedure' use only then you would/could set a flag, use a timer to go to a procedure that navigates to the 'child' block, does the 'clear_block', then navigates back to the 'parent' block and repeats the 'delete_record'. However, as the flag is 'set' it would NOT create the timer and would actually do the delete.

Again, my apologies for my sharp response.
David

Re: Have Dept and Emp block on form need to delete record on master [message #214388 is a reply to message #213061] Tue, 16 January 2007 03:44 Go to previous message
jawwikhan
Messages: 6
Registered: January 2007
Location: Pakistan
Junior Member

hi,

see clear_all_master_details program unit and comment out the portion of the code which checks the block for changed or NEW status and call for the dialog box .
example

IF curblk IS NOT NULL THEN
Go_Block(curblk);
Check_Package_Failure;
Clear_Block(ASK_COMMIT); -- comment out this portion

Hoping this will help u out

Thanks

Previous Topic: Problem in Progress Bar
Next Topic: How to run forms on Oracle 9i forms developer.. plzz help
Goto Forum:
  


Current Time: Fri Dec 09 09:29:37 CST 2016

Total time taken to generate the page: 0.15601 seconds