Subject Re: RECORD ON STREAMSOURCE
From Mervyn Bick <invalid@invalid.invalid>
Date Mon, 19 Mar 2018 08:49:25 +0200
Newsgroups dbase.getting-started

On 2018-03-19 7:20 AM, Ken Mayer wrote:
> On 3/18/2018 8:23 PM, KENT wrote:
>> How to count TOTAL record PER GROUP AS PRESENTED BELOW in the stream
>> source and GRAND TOTAL
>>
>>
>> GROUP 1 HEADER
>>          GROUP 2 HEADER
>>                       GROUP 3 HEADER
>>                                    -
>>                       GROUP 3 FOOTER TOTAL
>>          GROUP 2 FOOTER TOTAL
>> GROUP 1 FOOTER TOTAL
>>
>> GRAND TOTAL
>
> In the report designer look at the group summary stuff. (Menu, Layout,
> Add Groups and Summaries ...)
>
> You can add a group summary for each group footerband that you need, and
> then for the report total, add it to the report footerband.

As Ken has pointed out, the designer will do it for you.  I don't like
the blue text this gives so I always ended up doing some editing.  In
the end I settled for DIY.  Until I could remember what went into the
codeblock I used to copy and paste the example in the OLH for a text on
a group footerband or header band. :-) The agX() methods can count ahead
if necessary.

For a group total on a group headerband or footerband

text = {||this.parent.parent.agCount({||this.parent.rowset.fields[
"fldname" ].value})}

The agX() methods belong to the group object.  Select a group in the
Inspector and then select the Methods tab to view the available methods

For the outer codeblock

this is the text object
this.parent is the group headerband or footerband
this.parent.parent is the group which owns the methods.

For the inner codeblock

The designer assigns the rowset created by the query object to the
streamsource.  See the last line in the sourcecode before any event
handlers.

this is the group
this.parent is the streamsource

From here we have access to the fields and their values.

For a grand total on the reportgroup headerband or footerband

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

The outer codeblock is the same as for a group total.  The methods
belong to the reportgroup.

For the inner codeblock

this is the reportgroup
this.parent is the report

The report "owns" the streamsouce so from here we have access to the
fields and their values.

Mervyn.