Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to show the column total in a multi-record block?

Re: How to show the column total in a multi-record block?

From: Steve Cosner <stevec_at_zimmer.csufresno.edu>
Date: 1997/03/25
Message-ID: <5h7thd$iah@info.csufresno.edu>#1/1

In article <859178066.32687_at_dejanews.com>, <BrandonHo_at_RocketMail.com> wrote:
>1. How to create "total" item for each column in a multi-record block so
>that whenever a value changed in any cell, its associated column total
>will be updated. The column total is equal to the sum of all values in
>that column whether not is currently being displayed.
>
>2. How can I update all values in a column of a multi-record block? For
>example, a multi-record block contains two columns which are Column_A and
>Column_B. And Column_B := Column_A * Factor. Where Factor is a data entry
>field which user can be changed anytime. Therefor Column_B should be
>updated whenever user change the value in Factor.

On Question 2, Dmitry L. Zhuk gave a pretty good method, except that you need to run it from a when-timer-expired trigger, where the timer is started by the When-validate-item trigger on Factor.

On question 1, you need to write a procedure that loops through all your rows and calculates all the totals in the block. The procedure should be run immediately after execute-query runs. If you have a lot of rows, it will force fetching all rows, and may take some time.

Also, whenever any item value is changed in the block which affects any of the totals, in its When-validate-item trigger, start a timer to expire in 1 millisecond (this can be in a procedure). From the when-timer-expired trigger, run the same procedure you created to run after the execute-query. Just be sure you store the :system.cursor_item and :system.cursor_record before you start the loop, and then go back to the same item and record when the procedure's loop completes.

If you alow delete_record or duplicate_record, then you also need to run the same procedure from these key triggers.

Regards,
Steve Cosner



Try out QA, a dynamic data utility form. Quick display and update access to any table. http://members.aol.com/stevec5088 Received on Tue Mar 25 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US