Subject |
Re: Can render problem |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sat, 28 Nov 2015 22:34:04 +0200 |
Newsgroups |
dbase.getting-started |
On 11/28/2015 01:53 PM, Charlie wrote:
> Thanks for the help. I want to make sure I understand you.
>
> I don't want to combine the two fields qty * cost and qty * sell. I want to to list the totals separately. It seemed you were trying to combine them together and get a total. Am I correct? Is it really this complicated to do that?
It's not complicated at all. It is, in fact, dead simple event-driven
programming.
I misunderstood what you needed. The only change necessary is that you
will need two user-defined properties to store the two running totals.
function HEADERBAND_onRender
this.parent.nTotal = 0 // initialise group1.nTotal
this.parent.nTotal1 = 0 //initaise group1.nTotal1
return
function DETAILBAND_onRender
//add the value in text1.text to the running total in nTotal
this.parent.group1.nTotal += this.text1.text
//add the value in text2.text to the running total in nTotal1
this.parent.group1.nTotal1 += this.text2.text
return
function TEXT11_canRender
// fetch running total for display
this.text = this.parent.parent.nTotal
return true
function TEXT12_canRender
// fetch running total for display
this.text = this.parent.parent.nTotal1
return true
Actually, as you are only summing the product of two fields codeblocks
could well be feasible. The following hasn't been tested but it is
worth trying. Be aware though that if there is a zero value in any of
the fields involved the result will be not be the same as if you
followed the DIY route.
function TEXT11_canRender
this.text =
{||this.parent.parent.agSum({||this.parent.rowset.fields["qty"].value})}*{||this.parent.parent.agSum({||this.parent.rowset.fields["cost"].value})}
return true
function TEXT12_canRender
this.text =
{||this.parent.parent.agSum({||this.parent.rowset.fields["qty"].value})}*{||this.parent.parent.agSum({||this.parent.rowset.fields["sell"].value})}
return true
Mervyn.
|
|