Print Page | Close Window

how to use Shared variables and supress subreport

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=11933
Printed Date: 01 May 2024 at 3:44pm


Topic: how to use Shared variables and supress subreport
Posted By: REDBA
Subject: how to use Shared variables and supress subreport
Date Posted: 23 Dec 2010 at 5:09am
I'm using Crystal Reports 11
I'm using shared variables in the main report only to show total amount from subreport
Is there a way to supress the subreport without changing the vlue of the shared variable?
because once I supress the subreport the value will turn to zero



Replies:
Posted By: DBlank
Date Posted: 23 Dec 2010 at 5:13am
The sub report has to run in order to create the variable
suppress eveything in the subreport
place the sub report on its own section in the main report (above where you need to use the value)
set teh main report section that has the sub report in it to "suppress blank section"


Posted By: REDBA
Date Posted: 23 Dec 2010 at 5:18am
The problem is we still using the other report(subreport) on it is own
if I suppress everything on it ... then we won't be able to use it ...


Posted By: DBlank
Date Posted: 23 Dec 2010 at 5:20am

I am confused. If you do not what to suppress it why are you suppressing it to cause the problem to begin with?



Posted By: REDBA
Date Posted: 23 Dec 2010 at 5:27am
sorry for confusing you and thank you very much for your help
 
I meant to say in the main report we just need one variable from the subreport without showing that subreport in the main report ...
 
In the subreport itself we use it alone (by it is own)
 
what I understood from you to solve this issue (i might be wrong) is to suppress all the sections in the subreport itself ... which means if we run the subreport i won't show anyting ... just blank page
so we can not run it in it's own ...
 
Is that what you meant? please correct me if i'm wrong
 
Thank you again for your help
 


Posted By: DBlank
Date Posted: 23 Dec 2010 at 6:05am

I think you want an on demand sub report that also passes the variable.

That won't work but what you can do is have 2 versions of the sub report.
1 that suppresses all the fields but runs (as I suggested earlier) to pass the variable
the other is an on demand for viewing that does NOT pass any variable.


Posted By: REDBA
Date Posted: 23 Dec 2010 at 10:25am
Yes ... that will do it :)
 
Thank you very much for your support ....
 
and have happy & safe holiday Clap


Posted By: angelyin1984
Date Posted: 27 Jul 2011 at 5:09pm
Helo...
 
I face the same problem too....
 
can explain more about this: (because i not understand how to do it)

I think you want an on demand sub report that also passes the variable.That won't work but what you can do is have 2 versions of the sub report.1 that suppresses all the fields but runs (as I suggested earlier) to pass the variable the other is an on demand for viewing that does NOT pass any variable.

When i suppress the subreport in the main report at detail section the value shared out from the subreport will become zero, so i don't know how to do the next.
 
Thank you


Posted By: DBlank
Date Posted: 28 Jul 2011 at 4:45am

suppressed subreports do not run and therefore do not return any values. That is why you get 0.

However, you can make a sr with all fields in that sr suppressed. then make the palce teh sr on its own section in the main report.
now in the main report set this section to 'suppress blank section'.
Now the subreport runs but hides all of its data, them main report sees that it ran but the section it is on is blank and hides the section but the variable still gets pulled in because the sr report had to run in order to determine the above blank conditions.


Posted By: sharona
Date Posted: 29 Jul 2011 at 8:24am
easiset way is to place only the values you want to use or see in the sub,
make the color of the fields white and as small as possible,
make the sub as small as possible
but dont supress anything and make sure the variable is below the sub.
 


-------------
sharona


Posted By: willz06jw
Date Posted: 11 Dec 2013 at 11:00am

--From http://scn.sap.com/thread/1038505


In Crystal Reports 9 and later, you can suppress a subreport but still pass a shared variable with the correct data to the main report by following the steps below:

 

 

In the Subreport

 

-


 

 

1. Remove all conditional suppression formatting formulas.

 

2. Delete all drawing objects such as boxes, lines, etc.

 

3. Suppress all remaining subreport objects such as database fields, formulas, etc.

 

4. For all sections that contain no objects, select the 'Suppress' option in the Section Expert.

 

5. For all sections that contain suppressed objects, select the 'Suppress Blank Section' option in the Section Expert.

 

 

In the Main Report

 

-


 

 

1. Select the 'Suppress Blank Subreport' option in the subreport Format Editor.

 

2. Remove all borders from the subreport object in the subreport 'Format Editor'.

 

3. Select the 'Suppress Blank Section' option in the 'Section Expert' for the section containing the subreport.

 

 

Background Information

 

-


 

 

When working with subreports, the 'Suppress Blank Section' option forces CR to evaluate the subreport contained within the section to determine if the final subreport output is blank. The 'Suppress' option allows CR to bypass the subreport completely, because the section is suppressed. By forcing Crystal Reports to evaluate the suppressed shared variable formulas in the subreport, the data can be correctly passed from the subreport to the main report even though the subreport is not visible to the end user.



Posted By: GreatLakes
Date Posted: 10 Apr 2019 at 7:37am
DBlank thank you very much for explaining how to perform calculations using suppressed fields. I was using a subreport in my main report, and couldn't get the calculation to work without placing the calculated field into a section below the main line of information. Your solution of putting the subreport ahead of the main line and suppressing the subreport fields and suppressing the blank subreport section worked wonderfully.



Print Page | Close Window