Solved

Shared Variable from Subreport to Main report

Posted on 2008-10-15
3
3,156 Views
Last Modified: 2012-05-05
I have a report with about 5 details sections which are for the most part subreports.  I have created a subreport which is retreiving survey information for incidents.  The survey report displays the results of the survey in a summarized format as there are multiple questions.  I created a shared variable in the subreport as follows:
WhilePrintingRecords;
Shared numberVar TotalYes1 := {@Sum Comment1}

I then created a formula in the main report with the following details

WhilePrintingRecords;
Shared NumberVar TotalYes1;
TotalYes1

I placed this formula in a details section that I added below the details section that has the subreport.  The problem I am getting is that the shared variable (likely the first one evaluated) is appearing in the details section of the report however it is appearing for every detail record that appears even if there are no subreport results?
Any help is appreciated.
0
Comment
Question by:siocco1
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22722492
You need to conditionally suppress the value.

You could suppress if 0 - check the FORMAT FIELD --> Number
Custom format

Another way would be to reset the value before the subreport to say -1 then you suppress if it is still negative.

In the first detail sectiion before the subreport
WhilePrintingRecords;
Shared NumberVar TotalYes1;
TotalYes1 := -1;
''

Conditionally suppress the display formula

WhilePrintingRecords;
Shared NumberVar TotalYes1;
TotalYes1 = -1

mlmcc


0
 

Author Comment

by:siocco1
ID: 22723073
Why would i need to supress the value?  If the subreport is empty, would it not pass an empty string or not do anything?  
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 300 total points
ID: 22723617
No,  It would either set the value to 0 or leave it alone.

mlmcc
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question