Subject Re: [IBO] Running total column
Author Robert martin
Hi Eyal

I don't know if this is a dumb idea or not, but couldn't you change your
query to something like...


Select pk, Date, Desc, Amount (Select Sum(Amount) FROM xx Where pk < yy.pk)
FROM xx yy;

Seems like a slow way to do it but it would be simple and OK for small
data sets.

Rob Martin
Software Engineer

phone +64 03 377 0495
fax +64 03 377 0496
web www.chreos.com

Wild Software Ltd



Eyal wrote:

>
> Hi,
>
> I use the TIBO* components with 3rd party DB aware controls. I need to
> display accounting data in a grid, which is more or less trivial except...
>
> I need to display a column of the running total - that is, for each
> row the running total = (running total of previous row) + current row.
> For example:
>
> # Date Desc. Amount RunTot
> 1 1/1 Blah 100 100
> 2 2/2 Ding 200 300
> 3 3/3 Dong 300 600
> 4 4/4 Oops -400 200
> Etc.
>
> The problem is that I can't use a calculated column, because for each
> row the calculation event will need to access data from all previous
> rows. This results in the current row changing during the event (which
> wreaks havoc on connected controls), and very slow when there are
> several hundred rows.
>
> Another possible solution is to include a dummy column in the query,
> which creates another column, and then calculate the running totals
> once and store them in that column. However this marks all the rows
> for update, altough nothing really has changed in the underlying DB data.
>
> What I need is a "virtual column" that I can populate with the values
> I want, without disturbing the update status of the rows.
>
> Is there any such thing?
>
> Thanks,
>
> Eyal.
>
>
>
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> keyword-searchable FAQ, community code contributions and more !
>
>
> *Yahoo! Groups Sponsor*
> ADVERTISEMENT
>
>
> ------------------------------------------------------------------------
> *Yahoo! Groups Links*
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/IBObjects/
>
> * To unsubscribe from this group, send an email to:
> IBObjects-unsubscribe@yahoogroups.com
> <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>