Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Don't show record if no data in Subreport Post Reply Post New Topic
Author Message
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Topic: Don't show record if no data in Subreport
     Posted: 19 Dec 2012 at 2:00am
So here is a problem I have that I can't figure out.
I have a main report, one record pr line, placed in a group footer.At the end of that same record line is a subreport. Is there any way to not show records in Main if the Sub does not contain Record? If Main returns 20 records, but 10 of them don't return anything in the Sub, I don't want those records included. I can't for the life of me see any way to do this. Any hints and ideas?

Edited by TorLang - 19 Dec 2012 at 2:01am
IP IP Logged
shanth
Groupie
Groupie


Joined: 06 Aug 2012
Location: United States
Online Status: Offline
Posts: 75
Quote shanth Replybullet Posted: 19 Dec 2012 at 4:55am
I guess, You need to do some work around, pass the values/shared variables from sub-report to main report, formula to compare both values, use suppress (formula) based on your condition. Hope it helps, if not explain a bit more about your issue.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 19 Dec 2012 at 12:00pm
as Shanth indicates you would have to use a shared variable. IN order to pass it back you would have to run the sub report in a section above the gf (either in the GH or a GFa) and then return the value in a section below wher eyou run the sub report and then you can suppress a section belwo that based on that shared variable formula.
E.g.
run the sub report in Gfa
return the variable in GFb
move your other data from the main report to GFc and suppress it based on the value from GFb
IP IP Logged
DaBoujibo
Newbie
Newbie


Joined: 21 Feb 2012
Online Status: Offline
Posts: 28
Quote DaBoujibo Replybullet Posted: 20 Dec 2012 at 6:03am
To add on the great tips from Shanth and DBlank, in case you do not know where to go to suppress, go to the Section Expert, and select the formula button next to "Suppress" for the section you want to hide (detail, GH, GF, etc.).  That opens up the Formula Explorer for you to enter in your suppression formula as noted in the above posts.
IP IP Logged
TorLang
Groupie
Groupie


Joined: 13 Jun 2012
Location: United States
Online Status: Offline
Posts: 50
Quote TorLang Replybullet Posted: 20 Dec 2012 at 6:06am
Thanks a lot, guys. Solved it with a shared variable :-)
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