Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: bringing subreport totals back to a main report Post Reply Post New Topic
Author Message
PBSELDEN
Newbie
Newbie
Avatar

Joined: 18 Jun 2019
Online Status: Offline
Posts: 10
Quote PBSELDEN Replybullet Topic: bringing subreport totals back to a main report
    Posted: 23 Jun 2019 at 5:50am
I've now read 20 or 30 posts on this,so it isn't exactly new. But I am getting nowhere.
Here is the problem:
In my main report I select a group of client.ids.
This gives me the registered clients for that group.
I pass these ids to a subreport where I am looking for activity in the last week. Activity is captured in a different table.
This works and it brings back a 1 for each client who actually had activity. I get a 1 because my variable is defined as a distinctcount of services provided.
But I am unable to total the counts either in the subreport or in the main.
In the subreport I get a 1.
I assume this is because it is only looking back at the last item in the list of ids?
How do I get it to count, distinctcount, or add up the 1s in the subreport? And then pass that number back to the main report.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 27 Jun 2019 at 10:19am
Are you running the subreport for each ID or are you running it for a set of ID's?

-Dell
IP IP Logged
PBSELDEN
Newbie
Newbie
Avatar

Joined: 18 Jun 2019
Online Status: Offline
Posts: 10
Quote PBSELDEN Replybullet Posted: 27 Jun 2019 at 12:04pm
I have adjusted the subreport in the following way. I have created a group around the IDs. Initiated a variable in the group header. Put the group total in the group footer, and then created a grand total which I put in the footer.
WHILEPRINTINGRECORDS;
SHARED NUMBERVAR ACTIVE;
SHARED NUMBERVAR ACTIVETTL;
ACTIVETTL := ACTIVETTL + {@ACTIVE}

{@ACTIVE} IS THE GROUP TOTAL.
ACTIVETTL IS THE GRAND TOTAL.

In the main report, I initiated and declared the ACTIVETTL variable and put it in the group footer.

I have the subreport in the space just above it, in a group footer.

Everything looks good... except...

Now I have all of this space. I have suppressed everything except the group footer where the subreport is, and the group footer where my totals are. I have shrunk down the subreport by setting the font at 1 and squeezing the band down to where it is nearly invisible. But what I really need to do is suppress the whole thing (the band with the subreport) but if I do that, everything stops and I end up with zeroes.
What should be a 1 page report grows into many pages with 1 or 2 bands on each page.

Any thoughts?
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 27 Jun 2019 at 1:07pm
So you are not displaying anything in the sub-report(everything suppressed)?  If so, in the Format Editor for the sub-report, click on the Subreport tab, click on the Suppress Blank Subreport.  Then in the section where the sub-report is, in the Section Expert, click on Suppress Blank Section.
IP IP Logged
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.047 seconds.