Joined: 18 May 2007
Location: United States
Online Status: Offline
Posts: 1
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.
Joined: 17 May 2007
Online Status: Offline
Posts: 12
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.
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