Groups > dBase > dBase reports > Re: Agsum




Agsum

Agsum
Mon, 12 Nov 2007 19:19:28 -050
I have a calculated field "text5" (which contains numerals) in
form.streamsource1.detailband.value

How do I create an Agsum value? I've tried several ways
in the form.reportgroup.footerband 

{||this.parent.parent.agSum(||this.parent.rowset.parent.parent.chemicals1.rowset
.fields["valuestock"].value})}
Post Reply
Re: Agsum
Mon, 12 Nov 2007 19:32:32 -050
I have been able to sum other columns in the detailband using

this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["text5&
quot;].value})

but when I try to sum the calculated field I just get 0

Any help much appreciated


Simon C Wrote:

> I have a calculated field "text5" (which contains numerals) in
form.streamsource1.detailband.value
> 
> How do I create an Agsum value? I've tried several ways
> in the form.reportgroup.footerband 
> 
>
{||this.parent.parent.agSum(||this.parent.rowset.parent.parent.chemicals1.rowset
.fields["valuestock"].value})}
> 
Post Reply
Re: Agsum
Mon, 12 Nov 2007 21:37:30 -080
Simon C wrote:
> I have a calculated field "text5" (which contains numerals) in
form.streamsource1.detailband.value
> 
> How do I create an Agsum value? I've tried several ways
> in the form.reportgroup.footerband 
> 
>
{||this.parent.parent.agSum(||this.parent.rowset.parent.parent.chemicals1.rowset
.fields["valuestock"].value})}

If this is a calculated field, per your next message in the thread, how 
is it calculated?

If using "canRender", then the agSum() method won't work. However, if
it 
is added as a calculated field to the fields array (of the rowset of the 
query object), then it should work ...

Ken

-- 
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/

*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
Post Reply
Re: Agsum
Tue, 13 Nov 2007 01:06:21 -050
In article <o8ZBuyYJIHA.1988@news-server>, simon.catchpole@btconnect.com 
says...
> I have been able to sum other columns in the detailband using
> 
>
this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["text5&
quot;].value})
> 
> but when I try to sum the calculated field I just get 0
> 
> Any help much appreciated
> 
> 
> Simon C Wrote:
> 
> > I have a calculated field "text5" (which contains numerals)
in form.streamsource1.detailband.value
> > 
> > How do I create an Agsum value? I've tried several ways
> > in the form.reportgroup.footerband 
> > 
> >
{||this.parent.parent.agSum(||this.parent.rowset.parent.parent.chemicals1.rowset
.fields["valuestock"].value})}
> > 
> 
> 
Simon,

This worked for me in a report I made:

> text =
{||this.parent.parent.agSum({||this.parent.rowset.fields["testField"].
value})}

Notice the two sets of {}.

I created the calculated field like this in the datamodule:

this.table1 = new QUERY()
this.table1.parent = this
with (this.table1)
   onOpen = class::table1_onOpen
   database = form.data1
   sql = "select * from table1"
   active = true
endwith

function table1_onOpen

   local oFld

   oFld                = new field( )
   oFld.fieldName      := "testField"
   oFld.value          := 0	// initialize
   oFld.beforeGetValue := { || this.parent[ "member_ID" ].value / 100
}

   this.rowset.fields.add( oField )

return


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

.|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
.|.|.| ---------------------------------------------------------- |.|.|.
Post Reply
Re: Agsum
Tue, 13 Nov 2007 08:54:25 -050
Hi Geoff

Thanks for your message, unfortunately I still can't get this to work.
If I try to use the report wizard it wont let me choose a datamodule as the
source.
if i pull it across into the design pane I'm unable to access the Onopen
function.
Seems like I'm going backwards!
Any help much appreciated



Geoff Wass [dBVIPS] Wrote:

> In article <o8ZBuyYJIHA.1988@news-server>,
simon.catchpole@btconnect.com 
> says...
> > I have been able to sum other columns in the detailband using
> > 
> >
this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["text5&
quot;].value})
> > 
> > but when I try to sum the calculated field I just get 0
> > 
> > Any help much appreciated
> > 
> > 
> > Simon C Wrote:
> > 
> > > I have a calculated field "text5" (which contains
numerals) in form.streamsource1.detailband.value
> > > 
> > > How do I create an Agsum value? I've tried several ways
> > > in the form.reportgroup.footerband 
> > > 
> > >
{||this.parent.parent.agSum(||this.parent.rowset.parent.parent.chemicals1.rowset
.fields["valuestock"].value})}
> > > 
> > 
> > 
> Simon,
> 
> This worked for me in a report I made:
> 
> > text =
{||this.parent.parent.agSum({||this.parent.rowset.fields["testField"].
value})}
> 
> Notice the two sets of {}.
> 
> I created the calculated field like this in the datamodule:
> 
> this.table1 = new QUERY()
> this.table1.parent = this
> with (this.table1)
>    onOpen = class::table1_onOpen
>    database = form.data1
>    sql = "select * from table1"
>    active = true
> endwith
> 
> function table1_onOpen
> 
>    local oFld
> 
>    oFld                = new field( )
>    oFld.fieldName      := "testField"
>    oFld.value          := 0	// initialize
>    oFld.beforeGetValue := { || this.parent[ "member_ID" ].value /
100 }
> 
>    this.rowset.fields.add( oField )
> 
> return
> 
> 
> -- 
> Geoff Wass [dBVIPS]
> Montréal, Québec, Canada
> 
> .|.|.|        dBASE info at http://geocities.com/geoff_wass       |.|.|.
> .|.|.| ---------------------------------------------------------- |.|.|.
> .|.|.|             IT Consultant http://Geoff_Wass.com            |.|.|.
Post Reply
<< Previous 1 2 Next >>
( Page 1 of 2 )
about | contact