Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

summarized value of subreport value in main report 1

Status
Not open for further replies.

rbarekere

Technical User
Mar 2, 2009
29
US
i have designed a crystal report whch has groups say A, B and C in main report. I have created sub report by grouping C and sub report has the data (measures). Main report doesnot contain any measure.

Now the subreport is linked to main report based on prompt on C.

I have created a shared variable for the group total of C in sub report.

And I am getting correct value for group C in main report.

Now the problem for me is the requirement to show summarized value for grop B and grand total for A.

I did use Total = total +sharedval.

It works well for group A since there is a prompt for A in main report and user can select only one value of A.

But my above formula doesnot work good for Group B. It works like running count, in the sense secod row of group B will show total of first row of group B and the total of C in second row of B.

I tried to reset the sharedval to zero. But then it started me to show the value zero.

Any help on this regard will be apprecieated.

-Raghu
 
Let's say your sub is located in GF#3a and that you are referencing the shared variable in GF#3b. Change that formula to:

whileprintingrecords;
shared numbervar x;
numbervar grpAtot := grpAtot + x;
numbervar grpBtot := grpBtot + x;
x

Then in GH1 add a reset formula:

whileprintingrecords;
numbervar grpAtot;
if not inrepeatedgroupheader then
grpAtot := 0;

In GH2 add a reset formula:

whileprintingrecords;
numbervar grpBtot;
if not inrepeatedgroupheader then
grpBtot := 0;

Then in GF2 use a display formula:
whileprintingrecords;
numbervar grpBtot;

And for GF1 use this display formula:
whileprintingrecords;
numbervar grpAtot;

-LB
 
Worked. I had no clue earlier how i can reset the value for Group B.

In actual scenario there are only 2 groups and first group is a hierarchy of 2 levels. That makes my Group A and B. Since I am able to get the count of levels for hierarchy, formula that you have mentioned perfectly works fine for me.

Display formula then will be
whileprintingrecords;
numbervar grpBtot;
numbervar grpAtot;
if {@LevelNum}=1 then
grpAtot
Else
grpBtot

Accordingly Reset formula is also changed.

Thanks a lot to GURU.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top