Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have been a grateful member of this site for several years. I love this site and refer everyone to it!..."

Geography

Where in the world do Tek-Tips members come from?

Totals from subreport wrong when the group spans into multiple pages

raja2008 (TechnicalUser)
3 May 12 15:39
Hello Everyone!


I'm using Crystal 2008 and SQL Server 2005



    I have 2 groups in the main report

My subreport is in the footer of the group # 2

    I calculate the total documents in the subreport and pass it to the main report by using a shared variable.

   shared numbervar BarDataCount:=0;
BarDataCount:=Count ({Table.BarData}, {@Proper Bardata});


   Shared variable in Main Report
      Formula #SharedBarDataCount

      shared numbervar BarDataCount;
         BarDataCount;

This is placed in one of the footer sections of Group #2 below the Subreport section.


I use this variable to get the totals for the Group 1 # and the Grand Total.

    Formula :BardataBUnitCount


            shared numbervar BunitBardataCount;
            shared numbervar BarDataCount;
            shared numbervar GrandBarDataCount;
            BUnitBardataCount:=BUnitBardataCount+BarDataCount;
            GrandBarDataCount:=GrandBarDataCount+BarDataCount;
            BarDataCount:=0;
            BunitBardataCount;


I'm reseting the BardataCount here and displaying the BUnitBardataCount value in the Group #1 Footer

I placed  BUnitBardataCount reset formula in the Group #1 header

   Reset formula
        shared numbervar BunitBarDataCount:=0;



Everything works fine

The totals from subreport are coming fine to the main report
    and adding up fine for the Group #1 and Grand Totals

   Until the value of Group#1 spans into more than 1 page
    I mean if there more Group#2's under the Group#1 and they span into the next page

   Since the BunitBarDataCount is reseting on the Group#1 header

  whatever it adds up in the first page is setting back to '0' and then it is adding the values in the next page and displaying that total.


basically if there are multiple pages i'm getting the totals of only the ones in the last page for that Group#1.


Please help ,I don't know how to handle this.


Hope it is clear     
lbass (TechnicalUser)
5 May 12 17:42
You probably have a repeated group header so the reset formula is activated inappropriately. Use formulas like this for resets in group headers:

shared numbervar yourvar;
if not inrepeatedgroupheader then
yourvar :=0;

-LB
raja2008 (TechnicalUser)
7 May 12 7:52
Hello LB!

Thank you very much.

That is exactly what was happening.

I had the repeat group herdes on each page option  checked in the Change group options .

I have a question for you LB

   Where can we find all these options that we have in crystal reports.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close