Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: subreport totals Post Reply Post New Topic
Author Message
rayo
Newbie
Newbie


Joined: 18 May 2007
Location: United States
Online Status: Offline
Posts: 1
Quote rayo Replybullet Topic: subreport totals
    Posted: 18 May 2007 at 1:59am
I am a newbie.  I am trying to build a report connects 3 different datasource subreports that produce column GroupA, GroupB and GroupC with a Total to the right.  The separate datasource subreports were not a problem using cross-tabs.

But i cannot figure out how i can do a Total Column given how subreports and master reports function.  This would be easy with Excel... but cannot figure this out for CR.

EXample:
         GroupA GroupB GroupC Total
2001   10         5            4         19
2002   2            3            2         7
2003   1            2            2         5
Sum  13         10            8         31

Thank you in advance.

Rayo

IP IP Logged
GuestX
Newbie
Newbie


Joined: 17 May 2007
Online Status: Offline
Posts: 12
Quote GuestX Replybullet Posted: 18 May 2007 at 8:00am
I think you may need NumberVar array to store values and sum them in main report.   Array must be Shared so all reports can see it.

For main report header made new Formula where you initialize arrays like:
Shared NumberVar array GroupAvalues:=[0,0,0,0];
Then place those values to array in subreport:
Shared NumberVar array GroupAvalues;
GroupAvalues[index]:=ValuesHere;

Then after subreports has fill values you have one more formula to calculate sums:
Shared NumberVar array GroupAvalues;
NumberVar ATotals:=GroupAvalues[1]+GroupAvalues[2] ... etc.

Better way of using arrays is to use dynamic array.
Declare:
Shared NumberVar array GroupAvalues:=0

and when adding new value:
GroupAvalues[UBound(GroupAvalues)]:=value;
Redim preserve GroupAvalues[UBound(GroupAvalues)+1];//more space to array.

Maybe there is some other ways too



IP IP Logged
RealQMan
Newbie
Newbie
Avatar

Joined: 22 Aug 2007
Online Status: Offline
Posts: 25
Quote RealQMan Replybullet Posted: 22 Aug 2007 at 12:21pm
where in the crystal report do you write those code?? I am working on similar problems too...


IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.