Re: Immediate Update of Running total
Date: Fri, 22 Apr 1994 18:38:45 GMT
Message-ID: <CooBsM.D0G_at_mach1.wlu.ca>
In article <little_jeffrey_s-220494072227_at_jarhead.d52.lilly.com> little_jeffrey_s_at_lilly.com (Jeffrey S. Little) writes:
>In article <2p60ul$70e_at_hobbes.cc.uga.edu>, brian@natas () wrote:
>
>> hi,
>> I have a quick question that maybe someone could answer.
>> I have a master/detail, two block situation in FORMS30
>> on oracle version 6 where I need to update a total field
>> in the master block everytime the corresponding detail
>> total is entered or updated. This is not
>> difficult, I know, but I have not had any success
>> with it so far. Any replies or examples would be
>> much appreciated.
>
>If I understand your situation correctly, it seems that easiest thing to do
>is to define an ON-VALIDATE-FIELD trigger for your total field in the
>detail block which updates the total field in the master block. Whenever
>you change the (or enter) the value in the detail field and then navigate
>out of the field, this trigger will fire and update your master field.
>
ANother way of doing this with the advantage of not having to re-calc
the whole total is to...
- create a non-display total field (say ND) in the total block.
- PRE-FIELD TRIGGER ON detail field in detail block; :ND := nvl(:display_total,0) - nvl(:detail_field,0);
- POST-FIELD TRIGGER ON detail field in detail block; :display_total := nvl(:display_total,0) + nvl(:detail_field,0);
The idea being you subtract the current value of the detail field (behind the scene in :ND) then as you exit out of the field you can add back the new value of detail field and update the TOTAL field that is displayed.
With the method previous described you would have to perform some neat stuff to stop the user from exiting out of the field and back in and not have the total double count the value of the detail field. Received on Fri Apr 22 1994 - 20:38:45 CEST