Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Main Reoprt Total Of Subreports Post Reply Post New Topic
Author Message
jkjackson@gmail
Newbie
Newbie


Joined: 23 Apr 2012
Location: United States
Online Status: Offline
Posts: 3
Quote jkjackson@gmail Replybullet Topic: Main Reoprt Total Of Subreports
     Posted: 23 Apr 2012 at 10:10am
I need to know how to total the record count of a sub report into the main report. I have tried shared variables but I get an error that I can’t summarize shared variables. How do I work around this? The report is a listing of all customers and then a sub report of how many accounts each customer has. With this I want to able to show a grand total of customers with each account type. Although I can get the shared variable to give me the total I need for each costumer in the main report, I cant get it to summarize.
joe
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 23 Apr 2012 at 1:46pm
Create a different shared variable for each separate sub-report.  Then just add them together with "+" in the main report.
 
-Dell
IP IP Logged
jkjackson@gmail
Newbie
Newbie


Joined: 23 Apr 2012
Location: United States
Online Status: Offline
Posts: 3
Quote jkjackson@gmail Replybullet Posted: 27 Apr 2012 at 4:47am
I don’t think I was clear before, let me try and explain again. I have a main report grouped by the customer’s main account number. This grouping contains two sub-reports, one sub-report in Details Section-A, and another sub-report in Details Section-B. The sub-report in section A is a listing of all savings accounts and the sub-report in section B is a listing of all loan accounts. What I am attempting to do in the main report is show a total of how many customers with a certain loan type have more than one savings account and have other loan accounts than the one that we are filtering by. In the financial world we call this a market penetration report.
joe
IP IP Logged
jkjackson
Newbie
Newbie


Joined: 27 Jul 2011
Location: United States
Online Status: Offline
Posts: 6
Quote jkjackson Replybullet Posted: 04 May 2012 at 9:02am
So no one has ever had a need for such a thing. This is kind of hard to believe!
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 08 May 2012 at 4:23am
I've never done a report like that, but maybe you could try this?
In the Loan account subreport, count the number of loans for that person, (excluding the filter one, which I presume is a parameter). Or count tham all and take one off at the end.
Put that count into a shared number variable 'loan_count'.
In the Savings subreport, count the number of savings accounts for the person, and put that into a shared variable 'save_count'
Pass these counts to formulae in the main report group footer.
Create a formula that says 'Y' or 'N' if your conditions are fulfilled for that person, based on the counts.
You can then count the Y to see how many people you have overall that match your conditions.
 
IP IP Logged
jkjackson
Newbie
Newbie


Joined: 27 Jul 2011
Location: United States
Online Status: Offline
Posts: 6
Quote jkjackson Replybullet Posted: 08 May 2012 at 7:38am
"You can then count the Y to see how many people you have overall that match your conditions"
 
  I have tried this. Your last statement is were the issue is. When i try to do a count of the "Y" i get an error that say i cannot summerize this field. Any ideas?
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 09 May 2012 at 2:28am
If using a Running Total
Summarize the number of people (person id or whatever it is called)
Type of summary is Count
Evaluate using a formula where the condition is  the formula from the subreports = 'Y'

If this doesn't work, you will have to create a manual count using something like
Whileprintingrecords;
numbervar count_y;
if Formula = 'Y' then count_y := count_y + 1 else count_y := count_y;
 
 This will add 1 to your count every time your formula is Y, so by the end you will have counted them all.

 
IP IP Logged
jkjackson
Newbie
Newbie


Joined: 27 Jul 2011
Location: United States
Online Status: Offline
Posts: 6
Quote jkjackson Replybullet Posted: 09 May 2012 at 7:04am
THats what i ended up doing and got it to work. Thanks for your help!
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