Home » Developer & Programmer » Forms » Reflect Master Update on Detail
Reflect Master Update on Detail [message #410150] Thu, 25 June 2009 08:24 Go to next message
mkhalawi
Messages: 3
Registered: June 2009
Junior Member
Dear all

I have a Master-Detail form, one item in the Detail block (:Detail_blk.itm1) reads its value from another item in the master block (:Master_blk.itm2). I did that by setting the initial value property for the item in the detail to be :Master_blk.itm2

there are no problem when i insert a new record, but in case of update, when i update the Master item (:Master_blk.itm2), its value does not reflect on the Detail item (:Detail_blk.itm1).

I tried to write a normal assignment statment
(:Detail_blk.itm1 = :Master_blk.itm2)
in the Post_Update trigger on the Master block, but i face the following error:
"Record has been updated by another user,re-query to see change".

how could i reflect the changes in the master block on the detail block and to be saved when i commit.

Thanx alot
Re: Reflect Master Update on Detail [message #410151 is a reply to message #410150] Thu, 25 June 2009 08:27 Go to previous messageGo to next message
cookiemonster
Messages: 13960
Registered: September 2008
Location: Rainy Manchester
Senior Member
If the value in the detail block should always be the same as the master block then you shouldn't store it in the detail block at all.
Re: Reflect Master Update on Detail [message #410157 is a reply to message #410151] Thu, 25 June 2009 08:53 Go to previous messageGo to next message
mkhalawi
Messages: 3
Registered: June 2009
Junior Member
No not always the same, i have two scenarios
the first the user can change the value in the detail without effecting the value in the Master. but if the user changes the Master value, then the change should be reflected on the detail.
the second scenario is that the value is copied and the user can't change it.

thanx

Re: Reflect Master Update on Detail [message #410287 is a reply to message #410157] Fri, 26 June 2009 00:19 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
And how will the form know which scenario to follow?

David
Re: Reflect Master Update on Detail [message #410533 is a reply to message #410287] Sun, 28 June 2009 02:47 Go to previous messageGo to next message
mkhalawi
Messages: 3
Registered: June 2009
Junior Member
Dear all

the form is a little bit complicated, it contains many fields and functionalities, so its hard to explain the whole ideas. The main thing that i need is that i have tow fields, each one from different table, one is in the Master block, and the other is in the detail block, the initial value for the detail item must be the same as the master item. i manage to do this by setting the initial value property for the detail item, and it has no problem in the insertion, the detail item copy the value inserted in the master and commit successfully. but, if i update the master, the detail item does not copy the new value and remain carrying the old value.

Thanx Alot
Re: Reflect Master Update on Detail [message #410707 is a reply to message #410533] Mon, 29 June 2009 20:33 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Is this field a primary key?

If it is, then search this forum for 'update primary key'.

Bascially, you insert the new master and detail records and delete the old detail and master record, in that order, in the block 'on-update' trigger.

David
Previous Topic: FRM-18108
Next Topic: Not Abel to regenerate Excel file in oracle forms 10g
Goto Forum:
  


Current Time: Tue Dec 03 15:46:16 CST 2024