Print Page | Close Window

Subreport & Shared Variable

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3648
Printed Date: 05 May 2024 at 8:55am


Topic: Subreport & Shared Variable
Posted By: cvgalloway
Subject: Subreport & Shared Variable
Date Posted: 09 Jul 2008 at 8:22am
I have a main report that has data from 2 years sales history - the main report is sorted by the sales from the most year by customer (group 1) then I'm using groupnumber to show the ranking.
Now, I want to show the previous year's ranking within the report as well.  I added a subreport and sorted the sales by the previous year and used the groupnumber to rank.
The I created a shared variable in my main report and added it to the subreport.
No, in section expert of the subreport I did the following
suppress > x+2
whileprintingrecords;
shared numbervar cust;
{table.customer} <> cust
 
I did this to suppress the customer data except for the data matching the customer in the main report
 
But, this is not suppressing correctly - it is still showing all the results from the subreport. 
 
Please Help!!
Thanks
Catherine
 



Replies:
Posted By: vallance
Date Posted: 28 Jul 2008 at 6:31pm

I think that the error lies in the place you put the function. Did you put it in the section expert of the Main report or the Subreport?

Maybe it will work differently if you put it in the main report or the subreport. That would be the first thing I try.


Posted By: saoco77
Date Posted: 29 Jul 2008 at 5:47am
Have you linked the subreport to the main report??

Try linking the two by customer ID. This will create a selection formula by customer ID in the subreport.

You can create a link by right clicking on the subreport in the main report and selecting "Change subreport links"

Sarah


Posted By: cvgalloway
Date Posted: 29 Jul 2008 at 6:13am
I was able to get the report to work.
The shared variable should only be placed in the subreport - not in the main report.
 
Thanks for the input.
Catherine



Print Page | Close Window