Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Page Suppression based on Sub Report value Post Reply Post New Topic
Author Message
newuser11
Newbie
Newbie


Joined: 13 Dec 2011
Location: United States
Online Status: Offline
Posts: 2
Quote newuser11 Replybullet Topic: Page Suppression based on Sub Report value
     Posted: 13 Dec 2011 at 5:02pm
Hi,

In my main report, I have @rrpct which has
whilePrintingRecords;
shared numbervar rrshared;
rrshared

In my sub report I have @rrpct
whilePrintingRecords;
Shared numbervar rrshared := {@Pct};

The Subreport is being called at Page header A and to test the value being passed in my shared variable, I have displayed @rrpct in page header b.

I want the value of @Pct in my main report from the sub report.

The value in @rrpct is zero.

Can you suggest what to do to get the value in my shared variable or what needs to be done.

Thanks in advance.
New User.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 14 Dec 2011 at 8:38am
what is happening in page header a?  is it suppressed?
 
if the section is suppressed the subreport won't run.
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 14 Dec 2011 at 8:42am
For some reason I think you should try this; I have had issues with suppressed sub reports returning a "zero" value.
 
What I have done, is turn off "can grow" show no borders, and make the sub barely visible. In the subreport options, I setup a formula for can grow, if shared>1 or whatever.
 
There are probably better ways, but that is how i do it
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 15 Dec 2011 at 3:15am
another way is to suppress all the fields in the subreport...so it doesn't display anything, then in the main report place the subreport in its own section and in the Section Expert check the box to suppress blank sections.
 
CR runs the subreport, 'sees' that nothing is displayed and suppresses the section.
 
This solution was originally given by Brian, and oddly enough works like a charm ;)
 
Before finding this solution, I did as comatt1 did.  This solution is easier to maintain as you don't have to worry about what is in that tiny section or where the subreport is if you need to change something.
 
HTH
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 15 Dec 2011 at 3:21am
Thanks for that other option too lockwelle...
When I usually have subreports they occasionally have headers, this could pose a problem... I am sure i could get creative with using the footers as detail sections though

Edited by comatt1 - 15 Dec 2011 at 3:23am
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum