Home » Developer & Programmer » Forms » Help :Unable to update or refresh a field in master block when deleting detail record (merged)
Help :Unable to update or refresh a field in master block when deleting detail record (merged) [message #206841] Fri, 01 December 2006 13:34 Go to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Hi,
I am new to the forum and i have a question relating to Oracle form and i hope someone can help. Here is the scenario:

I have form which has a master block and a detail block. THey both display multiple record at the same time.

When i delete a detail record which has one field value matches to one field in master block , i can't refresh the matching field. In detail block, i use trigger when-remove-record to do this, but i can't navigate to the master block from this trigger.

Let me give you an example:

Master block has

Field1 Field2
1 2


In detail block:

Field1 Mem1 Mem1
1 a1 1
1 b1 2

Now, when i delete a detail record in red, I would like the master record looks like this at runtime

Field1 Field2
1

Since Field2 has value of 2 which matches to Mem1 (value of 2). So after delete , Field2 will be set to NULL.

Thanks very much.
Re: Help :Unable to update or refresh a field in master block when deleting detail record [message #207039 is a reply to message #206841] Mon, 04 December 2006 00:17 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
What happens if you put
select decode(:master.field2-1,0,null,1,null,:master.field2-1)
  into :master.field2
  from dual;
in the When-Remove-Record trigger?

David
Re: Help :Unable to update or refresh a field in master block when deleting detail record [message #207186 is a reply to message #207039] Mon, 04 December 2006 09:19 Go to previous messageGo to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Thanks, djmartin.
It clears out the field , no matter field2 matches to Mem1 or not. Since i can navigate out of the detail record when in query mode, i can't check for the match before decode the value.

Also, when i use the mouse to go to the master record, there is a popup message asking to save record. If i click OK, then it saves to db , but if i click CANCEL, then the Field2 does not rollback the original value. Is there a way to prevent this?


[Updated on: Mon, 04 December 2006 09:41]

Report message to a moderator

Re: Help :Unable to update or refresh a field in master block when deleting detail record [message #207202 is a reply to message #207186] Mon, 04 December 2006 10:17 Go to previous messageGo to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Update:

I've fixed the problem of updating field to NULL as expected. Only one problem i have right now is every time i use mouse to move to master record, a popup message asking me "Do you want to save the changes you made YES NO CANCEL". How could hide this message and wait until exiting the form to commit?

thanks.
How to remove warning message "Do you want to save the change you have made" [message #207227 is a reply to message #206841] Mon, 04 December 2006 14:51 Go to previous messageGo to next message
michaelv
Messages: 20
Registered: November 2006
Location: rockville, MD
Junior Member
Hi,
I have searched through the forum but couldn't find the answer for my problem.
Here is the scenario: i have a form with a master block and a detail block. Both block display multiple records at the same time.

When i delete a detail record, i move mouse the the master record where there is a match between the master and the detail, then from there i move mouse to any master record, i receive the message " Do you want to save the change you have made"

I put the "POST" in when-new-record-instance in master block.

I hope someone could help me to get a way with this message. I have tried different way as suggested from other posts, but no luck.

thanks a lot.

Michael.
Re: Help :Unable to update or refresh a field in master block when deleting detail record [message #207248 is a reply to message #207202] Mon, 04 December 2006 19:13 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Its because the form is performing an execute_query between the master and detail and needs to do something with your changes. Either commit your changes in your code or use 'post' to 'hold' them.

David
Re: How to remove warning message "Do you want to save the change you have made" [message #207249 is a reply to message #207227] Mon, 04 December 2006 19:18 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Please don't start new threads on the same topic.

Put the 'post' in a 'post-' trigger, like 'post-block' on the 'detail' block or maybe in the 'pre-query' of the 'master' block but you will have to test whether this works. The 'post' has to be done before you have moved on to the code that will do the 'execute_query'.

David
Previous Topic: shockwave flash
Next Topic: Error Messages
Goto Forum:
  


Current Time: Sun Dec 04 18:25:34 CST 2016

Total time taken to generate the page: 0.10141 seconds