ReportViewer problem counting rows and totals

Giganews Newsgroups
Subject: ReportViewer problem counting rows and totals
Posted by:  QSIDeveloper (QSIDeveloper@newsgroup.nospam)
Date: Thu, 14 Feb 2008

I am using ReportViewer and am having problems counting objects (rows) and
totals by group.

I am writing a "Check Amounts" report using Visual Studio 2005 ReportViewer
and *.RDCL.  This is a local report using an object for a datasource.
I have an rdcl defined with a table.

The object contains DateTime (DateTime), Account Number (long), Transaction
Type (String)  and Amount(float).
Transaction types can be "VOID", "REPRINT", "MANUAL".
The printed columns in the report match the object.

The report should print the following:
Total amounts and row count by Date/Account Number  for each Type - if the
row count for the type is greater than 0.  If the Type row count is 0 the
total should not print.

The end of the report should print:
Total amounts and row count for the All rows
Total amounts and row count for each all Types

The report should look something like this:
************************************************************DateTime
Account Number      Transaction Type      Amount

12/01/05  1:00      10                          REPRINT
1000.00
12/01/05  1:15    10                          VOID
1000.00

Number of REPRINTS: 1      Total REPRINTS: 1000.00
Number of VOIDS: 1            Total VOIDS: 1000.00

12/02/05    12:30  20                          REPRINT
1000.00
12/02/05    12:31  20                          VOID
1000.00
12/02/05    12:32  20                          MANUAL
1000.00
12/02/05    12:33  20                          MANUAL
1000.00

Number of REPRINTS: 1      Total REPRINTS: 1000.00
Number of VOIDS: 1            Total VOIDS: 1000.00
Number of MANUAL: 2        Total MANUAL: 2000.00

12/03/05    10:30  30                            MANUAL
1000.00
12/03/05      10:45  30                            VOID
  1000.00

Number of VOIDS: 1              Total VOIDS: 1000.00
Number of MANUAL: 1          Total MANUAL: 1000.00

Report Totals:
Number of REPRINTS: 2      Total REPRINTS: 2000.00
Number of VOIDS: 3            Total VOIDS: 3000.00
Number of MANUAL: 3      Total MANUAL: 3000.00

************************************************************
I am having problems getting get the total amount and row count by Type.  I
have read a ton of material on the MSDN wedsite and elsewhere, but can't seem
to find something close and/or  figure this out.

I set up a table with a header, details and footer.
I set up a group.  The group has two expressions to break by date and
account number.  Here are the group expressions:
=(Year(Fields!DateTime.Value) & Month(Fields!DateTime.Value) &
Day(Fields!DateTime.Value))
=Fields!AccountNumber.Value

The grouping does break and print at the correct places.  However, I am
having problems getting the totals that we are looking for.
I am having problems counting objects (rows) and totaling amounts by  type
for the group.

To count rows for a Type within a group I have tried:
=Count(Fields!ReportType.Value="VOID")
=Count(Fields!ReportType.Value="MERGED", "DateAccountGroup")
=Aggregate(Count(Fields!ReportType.Value="ACH"))  // cannot nest aggregate
functions
=Aggregate(Fields!ReportType.Value="ACH")// must be simple field reference
=Aggregate(Fields!ReportType.Value, "DateAccountGroup")
Error 1 The Value expression for the textbox ‘textbox59’ uses the function
Aggregate with an invalid scope parameter.  The scope parameter must be the
name of a scope where all containing grouping scopes have group expressions
which are simple field references.
C:\Common.NET\QuadrantSoftware\Daytona\Banking\Report\AuditLogReport.rdlc
QuadrantSoftware.Daytona.Banking.Report

To add up all the Amounts for a type I have tried
=Sum(IIf(Fields!ReportType.Value="VOID", Field!Amount.Value,0)) // adds all
rows in group, regardless of type

I set up a table footer
=Count(Fields!ReportType.Value="ACH")
=Sum(IIf(Fields!ReportType.Value="VOID", Fields!Amount.Value,0))//

Thanks

Replies