Subject Re: Totaling fields in a report
From Charlie <tm@tc.com>
Date Thu, 22 Dec 2022 04:26:19 -0500
Newsgroups dbase.getting-started

Thanks for the help.

I didn't realize you could group and total in layout.  Very helpful.  So....

this.reportGroup.footerBand.TEXT4 = new TEXT(this.reportGroup.footerBand)
   with (this.reportGroup.footerBand.TEXT4)
      height = 0.1708
      left = 2.0104
      top = 0.0
      width = 1.3889
      variableHeight = true
      prefixEnable = false
      colorNormal = "b+"
      alignHorizontal = 2        // Right
      text = {||this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["PRICE"].value})}
   endwith

But I want to get a grand sum of qty*price.  I tried this

{||this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["PRICE"].value*this.parent.STREAMSOURCE1.rowset.fields["QTY"].value})}

But that does not work.  Produces a blank.  Is there a way to express this so I get a value?


Charlie Wrote:

> I am trying to total price , qty in a report.  I have attached the code.  Someone helped me do this several years ago and the other program works well so I tried to replicate what I think I did back then with that report.  However the other report I believe was created from scratch where this one was created by the wizard.  Possibly that is a factor.  With this attempt I am getting an error variable undefined for either ntotal or text2.  I have tried different parent combos (which I don't understand).   The bulk of the problem I think lies at the bottom code lines of the attachment.  
>
> Any help will be very much appreciated.
>