bringing subreport totals back to a main report
Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22786
Printed Date: 02 May 2024 at 3:35am
Topic: bringing subreport totals back to a main report
Posted By: PBSELDEN
Subject: bringing subreport totals back to a main report
Date 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.
|
Replies:
Posted By: hilfy
Date 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
------------- Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics
|
Posted By: PBSELDEN
Date 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?
|
Posted By: kevlray
Date 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.
|
|