?
Solved

Shared Variable from Subreport to Main report

Posted on 2008-10-15
3
Medium Priority
?
3,169 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 101

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 101

Accepted Solution

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

mlmcc
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

801 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