Groups > dBase > dBase reports > Re: Problems with summary calculations




Problems with summary calculations

Problems with summary calculations
Mon, 25 Jun 2007 13:04:46 -040
Printing invoices, the line-item totals should add up to an invoice total.  The
fllowing code does not give the required results (dBase reports: p 158 - 159):

   function TEXTBALANS1_onRender
      if type("form.rt_balans") = "U"
         form.rt_balans = 0
      endif
      local f
      f =
this.parent.parent.parent.rekeningedatamodule1.ledegeld1.rowset.fields
      form.rt_balans += f["balans"].value
      ? form.rt_balans
      return

The printed form.rt_balans shows the correct total

However in the canRender method below, the form.rt_balans shows nothing.  The
type statement indicates that it is numeric.
 
   function TEXT2_canRender
   ? type("form.rt_balans"), form.rt_balans
      this.text := form.rt_balans
      return true

Why?
Post Reply
Re: Problems with summary calculations
Wed, 27 Jun 2007 00:49:00 -040
In article <TxW4ur0tHHA.1096@news-server>, psvh@mweb.co.za says...
> Printing invoices, the line-item totals should add up to an invoice total. 
The fllowing code does not give the required results (dBase reports: p 158 -
159):
> 
>    function TEXTBALANS1_onRender
>       if type("form.rt_balans") = "U"
>          form.rt_balans = 0
>       endif
>       local f
>       f =
this.parent.parent.parent.rekeningedatamodule1.ledegeld1.rowset.fields
>       form.rt_balans += f["balans"].value
>       ? form.rt_balans
>       return
> 
> The printed form.rt_balans shows the correct total
> 
> However in the canRender method below, the form.rt_balans shows nothing. 
The type statement indicates that it is numeric.
>  
>    function TEXT2_canRender
>    ? type("form.rt_balans"), form.rt_balans
>       this.text := form.rt_balans
>       return true
> 
> Why?



Pieter,

If I recall correctly, by the time you reach onRender(), the rowset is 
already pointing to the _next_ row. If a total or subtotal has already 
been rendered, it would have been rendered just before you get to this 
point. I am betting Ken sets the value to zero during that process, so 
that form.rt_balans += f["balans"].value is effectively starting to
sum 
the values for the _next_ total.

Perhaps something is hiding the value. Is TEXT2 sufficient wide? Does it 
need a the value to be TRANSFORM()ed? Does it have a .height? Does it 
work if you stick in

this.text := "Here I am!" 

?

-- 
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
Re: Problems with summary calculations
Sat, 30 Jun 2007 03:01:12 -040
Thanks Geoff, You pointed me in the right direction!


Geoff Wass [dBVIPS] Wrote:

> In article <TxW4ur0tHHA.1096@news-server>, psvh@mweb.co.za says...
> > Printing invoices, the line-item totals should add up to an invoice
total.  The fllowing code does not give the required results (dBase reports: p
158 - 159):
> > 
> >    function TEXTBALANS1_onRender
> >       if type("form.rt_balans") = "U"
> >          form.rt_balans = 0
> >       endif
> >       local f
> >       f =
this.parent.parent.parent.rekeningedatamodule1.ledegeld1.rowset.fields
> >       form.rt_balans += f["balans"].value
> >       ? form.rt_balans
> >       return
> > 
> > The printed form.rt_balans shows the correct total
> > 
> > However in the canRender method below, the form.rt_balans shows
nothing.  The type statement indicates that it is numeric.
> >  
> >    function TEXT2_canRender
> >    ? type("form.rt_balans"), form.rt_balans
> >       this.text := form.rt_balans
> >       return true
> > 
> > Why?
> 
> 
> 
> Pieter,
> 
> If I recall correctly, by the time you reach onRender(), the rowset is 
> already pointing to the _next_ row. If a total or subtotal has already 
> been rendered, it would have been rendered just before you get to this 
> point. I am betting Ken sets the value to zero during that process, so 
> that form.rt_balans += f["balans"].value is effectively starting
to sum 
> the values for the _next_ total.
> 
> Perhaps something is hiding the value. Is TEXT2 sufficient wide? Does it 
> need a the value to be TRANSFORM()ed? Does it have a .height? Does it 
> work if you stick in
> 
> this.text := "Here I am!" 
> 
> ?
> 
> -- 
> Geoff Wass [dBVIPS]
> Montréal, Québec, Canada
> 
> .|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
> .|.|.| ---------------------------------------------------------- |.|.|.
> .|.|.|             IT Consultant http://Geoff_Wass.com            |.|.|.
Post Reply
Re: Problems with summary calculations
Sun, 1 Jul 2007 01:42:58 -0400
In article <QdpuxRuuHHA.1108@news-server>, psvh@mweb.co.za says...
> Thanks Geoff, You pointed me in the right direction!
> 
> 

Pieter,

You're most welcome! Thank-you for the success report. Good luck!

-- 
Geoff Wass [dBVIPS]
Montréal, Québec, Canada

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
about | contact