Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: supress dat on main report based on subreport data Post Reply Post New Topic
Page  of 2 Next >>
Author Message
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Topic: supress dat on main report based on subreport data
    Posted: 02 Aug 2012 at 8:28am
Hi,
 
I have a report pulling data from a subreport.
I want to supress the detail line if a value on the subreport is a certain value.
 
example
 
Joe Jones 1/1/2012  Yes
Bill Jones  1/1/2012 No
 
Whewre Yes/No is cioming from supreport
 
Lets say I want to surpress lines with subreport field = 'No'
 
Thanks IN Advance
 
Joe
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Aug 2012 at 8:31am
you have to bring the value back into the main report as a shared variable
both the subreport and the variable need to be place it in a section above/prior to the section you want to suppress and you can then suppress the section using the shared variable result in the main report
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 02 Aug 2012 at 8:39am
thanks for getting back...
I read a bit about it , but not really sure how to do the shared variable..
Any example or pages you can point me to?
 
Thanks
Joe
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Aug 2012 at 9:08am
in the sub report you create a formula with a shared variable assigning the value you want to return
 
shared stringvar x;
x: = (your yes no value field here)
 
in the main report create another formula field and do the same thing but assign it as
 
shared stringvar x;
x:=x
 
this moves the value from teh sub report to the main report
you can now reference this formula field in a suppression statement
eg. @formula='Yes'
 
note that sub reports cannot be suppressed and still run.
there is a trick to this. Suppress all of the fields in the subreport, set the sub report to suppress when blank and then set the sectio it is on to suppress when blank. It still runs this way.
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 02 Aug 2012 at 9:14am
Thanks Im ging to try and Let u know how I do...
Really appreciate it...
 
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 02 Aug 2012 at 10:12am
Ok, so I have the shared variable on the sub and main report and the data is pulling over. I know you said to put it in the section above but it seems to be null its in the group header
The data I want to surpress is in the detail section
When I put it in the detail section it seems to keep the same value until the value on the subreport changes?
 
Thanks
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Aug 2012 at 10:22am
make a details A - put the sr in that
detailsB - pu the shared variable formula in that
make the rest of your regular report as detailsC


Edited by DBlank - 02 Aug 2012 at 10:22am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Aug 2012 at 10:24am
Note you can replace your subreport in details C with the shared variable formula in the main report so you are not running the same sub report twice per record which will unnecessarily slow down your report
IP IP Logged
jbalbo
Senior Member
Senior Member
Avatar

Joined: 17 Feb 2011
Online Status: Offline
Posts: 219
Quote jbalbo Replybullet Posted: 02 Aug 2012 at 11:03am
sorry to be a pain....
so, I think I almost have it...
 
Detail A I have the subreport
Detail B I have the formula for the main report(shared stringvar x;
x:=x
and I have detail b surpressed.
Detail C I have the data I want to show...
 
I went ahead and hide drill down ok in the subreport
 
but if I try to hide Detail A in the main, I loose my data
 
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Aug 2012 at 11:08am
yep. The subreport will not run if it is suppressed (my original post warning).
if you have it working as desired,
suppress all of the fields in the subreport,
in the main report,
right click on the sub report and select Format Sub report
select the Subreport tab
mark 'suppress blank subreport' as true
in teh section expert (main report) mark details a section as suppress when blank.
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.