Print Page | Close Window

Yet another questions about subreport totals

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16413
Printed Date: 18 May 2024 at 7:43pm


Topic: Yet another questions about subreport totals
Posted By: theghetto
Subject: Yet another questions about subreport totals
Date Posted: 10 May 2012 at 2:03pm
I have a variable from a sub report being passed to the main report. That variable is a sum of a column in the sub report. I'm then summing the sum in the main report using a global variable and that is all working fine.

But, the data in the sub report is being filtered not just by the default parameter linking sub report to main report, but also by a user input parameter on a column in the sub report.

The end result is the main report is displaying the proper lines from the sub report that I want (although there is a blank detail line with a header from the sub report where the user input parameter doesn't match.)

The problem is the variables are including the data that is hidden on the main report, summing the values that are filtered by the user input parameter.

I hope this makes sense, very difficult to explain this properly.   Can anyone help me with this?

Thanks,

Matt




Replies:
Posted By: lockwelle
Date Posted: 11 May 2012 at 4:14am
sounds like you need to adjust the logic for the shared variable in the subreport.
 
if you are just using SUM in the subreport, it will report everything, including items that were suppressed. To correct this, you would want to increment your shared variable for each line of detail that is displayed, then the variable will always represent what the user is seeing on the report.
 
HTH


Posted By: theghetto
Date Posted: 16 May 2012 at 6:46am
Thanks for your response, I'm just finally getting back to finishing this report.

Can you get me a bit closer here?   I'm comfortable with Crystal but am fairly new to playing with variables.

Right now I just have a formula in the subreport called "shared" that contains

shared numbervar test:={@sum2};

I understand what you are saying about incrementation, but what's the syntax to say "where the detail line is displayed" ?

Thank you for your help!


Posted By: theghetto
Date Posted: 16 May 2012 at 7:55am
Oh I think I've got it.

I placed the formula on the detail line of the subreport, and changed the formula to

shared numbervar test:=test+{@subtotaqls};


That seemed to have done the trick.   Thank you!




Print Page | Close Window