Home » Developer & Programmer » Forms » Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record (merged)
Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record (merged) [message #331578] Fri, 04 July 2008 02:00 Go to next message
rhnshk
Messages: 20
Registered: May 2008
Junior Member
I have a master-detail form, my blocks & Triggers r;

<Block>HEADER
ITEM

hinv_date (pk)
hinv_code (pk)
hinv_no (pk)
hinv_tot_qty
hinv_gross_amount
hinv_disc_percentage
hinv_disc_amount
hinv_net_amount

<Block>DETAIL
TRIGGER
PRE-RECORD

:DETAIL.dinv_amount := :CTRL.m_dinv_amount
:HEADER.hinv_tot_qty := :CTRL.m_dinv_QTY
:HEADER.hinv_gross_amount := :CTRL.m_hinv_gross_amount
:HEADER.hinv_disc_amount := :CTRL.m_hinv_disc_amount
:HEADER.hinv_net_amount := :CTRL.m_hinv_net_amount
WHEN-REMOVE-RECORD
:DETAIL.dinv_amount := :CTRL.m_dinv_amount
:HEADER.hinv_tot_qty := :CTRL.m_dinv_QTY
:HEADER.hinv_gross_amount := :CTRL.m_hinv_gross_amount
:HEADER.hinv_disc_amount := :CTRL.m_hinv_disc_amount
:HEADER.hinv_net_amount := :CTRL.m_hinv_net_amount
ITEM
dhinv_date (fk)
dhinv_code (fk)
dhinv_no (fk)
dinv_qty
WVI
:DETAIL.dinv_amount := :CTRL.m_dinv_amount
:HEADER.hinv_tot_qty := :CTRL.m_dinv_QTY
:HEADER.hinv_gross_amount := :CTRL.m_hinv_gross_amount
:HEADER.hinv_disc_amount := :CTRL.m_hinv_disc_amount
:HEADER.hinv_net_amount := :CTRL.m_hinv_net_amount
dinv_rate
WVI
:DETAIL.dinv_amount := :CTRL.m_dinv_amount
:HEADER.hinv_tot_qty := :CTRL.m_dinv_QTY
:HEADER.hinv_gross_amount := :CTRL.m_hinv_gross_amount
:HEADER.hinv_disc_amount := :CTRL.m_hinv_disc_amount
:HEADER.hinv_net_amount := :CTRL.m_hinv_net_amount
dinv_amount
<Block>ctrl
m_dinv_amount (formula = dinv_qty * dinv_rate)
m_hinv_qty (Summary = dinv_qty)
m_hinv_gross_amount (Summary = dinv_amount)
m_hinv_disc_percentage (Fixed .4%)
m_hinv_disc_amount (Formula = m_hinv_gross_amount * m_hinv_disc_percentage/100)
m_hinv_net_amount (Formula = m_hinv_gross_amount - m_hinv_disc_amount)

the problem m facing is when m deleting a record from the detail block, it saves the detail records perfectly and also updates the header-columns in the header-block, of that particular txn.
But the strange thing that i notice is that, this delete-record-discand is making the column values
(hinv_tot_qty,
hinv_gross_amount,
hinv_disc_percentage,
hinv_disc_amount,
hinv_net_amount)
to NULL/ZERO of the header-Txns saved earlier.

to present a more clear picture of my problem,plz see below the Sql print, i tried to delete from Form, Txn No 37 ( there was 1 more record in the detail-BLOCK FOR TXN NO 37);

HEADER
CODE NO ITEM QTY AMOUNT PER% DISC_AMT NET_AMT
------ ------------- ---------- ------------- ------------- ------------- ------------- -------------
BUY 33.000 S00000
BUY 34.000 S00002
BUY 35.000 S00007
BUY 36.000 S00009
BUY 37.000 S00000 300.000 75.000 .400 .300 74.700
BUY 38.000 S00000

DETAIL
CODE NO ITEM QTY RATE AMOUNT
------ -------------- ------ ------------- ------------- ----------------
BUY 33.000 S00000 2000.000 1.500 3000.000
BUY 34.000 S00002 500.000 .125 62.500
BUY 35.000 S00007 200.000 .355 71.000
BUY 36.000 S00009 200.000 4.500 900.000
BUY 37.000 S00000 300.000 .250 75.000
BUY 38.000 S00000 5000.000 2.290 11450.000
BUY 38.000 S00000 6000.000 2.120 12720.000

Now lets say if i try to delete txn no 38, it will properly delete any of the the DETAIL record i wish & updates the matching HEADER record no 38. but will also make columns
"QTY,AMOUNT,PER,DISC_AMT & NET_AMT" null/zero for HEADER-Txn no 33,34,35,36,37
  • Attachment: sQL1.JPG
    (Size: 81.20KB, Downloaded 140 times)
Re: Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record [message #331600 is a reply to message #331578] Fri, 04 July 2008 03:24 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
If you would care to read the posting guidelines, as indicated in the link in the BIG yellow bar on top of the forum-page, you would see that there is no need to use an image to display your results formatted..
Re: Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record (merged) [message #338735 is a reply to message #331578] Tue, 05 August 2008 19:58 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I really don't want to ask but have you solved your problem?

David
Re: Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record (merged) [message #339295 is a reply to message #338735] Thu, 07 August 2008 04:18 Go to previous messageGo to next message
rhnshk
Messages: 20
Registered: May 2008
Junior Member
Hello Mr. David!

Thank you for asking me. Actually, i did check for an answer, but when i did'nt see any reply, then i did it as per form4.5 approach by storing the formula-returnd value into a control variable & thus finally m able to save now.

still i would appreaciate to know how 1 can do it by asSining formula/Summary property to an item in form6i and Store its result without loosing any data in the header-block, as i have explained in my question.
Re: Delete a DETAIL record,causes HEADER column values NULL/ZERO for old Record (merged) [message #339668 is a reply to message #339295] Fri, 08 August 2008 02:01 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
I can see no reason for all the data movement that you are doing. If it works, then just leave it alone.

David
Previous Topic: I get FRM 40350 error,but records are getting displyed
Next Topic: How to reorder a non-database item in a form
Goto Forum:
  


Current Time: Fri Dec 09 19:09:36 CST 2016

Total time taken to generate the page: 0.13487 seconds