Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subreport calculation/main report calulation 1

Status
Not open for further replies.

tc3596

Technical User
Mar 16, 2001
283
My main report displays group 1 totals with a restriction and my subreport shows the same totals but without the restriction. No details are diplayed in either report. I want to take my calculation from my subreport and use it in a formula in my main report. Group 1 is the same in both reports. All I want to do is to be able to get a percentage of my main report group 1 totals vs my subreport group 1 totals. P.S. my group 1 is a 'specified order' of rooms. (rooms 1-19 is called 'MOR', rooms 20-29 is called 'CVOR'). The main report shows 'MOR' having 14 distinctcounts of rooms, while the subreport shows 'MOR' having a distinct count of 22 rooms. 14/22, seems simple enough. Thanks.
 
What version of CR?
Is there a link field between sub and main report?
Are their the same number of groups each time the report is run? How many?
Are you familiar with Crystal variables? Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
I'm in Crystal 8. The main and sub report are practically identical, the only difference is that the main report includes a restriction in the record selection formula. Both reports display the 6 groups (each group is based on room groups, i.e. 1-19 is labeled MOR, etc...) Each group creates a distinct count of procedure dates for that group. So, I imagine the link field could be the group header, or the distinct count of procedure dates. I've placed a function in the group header to display the same results in both reports. Yes, the same # of groups are displayed each time it's run. (6 groups for both reports. Re: variables: I tried something last night that that I got off crystal's site, but it didn't pull the exact data. (it involved using shared variables)
 
This can probably be done simpler without the subreport. Simply add a formula that says:


if {your criteria from subreport}
then {field you want to distinct count}
else ""

Now do a distinct count summary field of this new formula, for each group. In a final formula subtract 1 from the distinct count subtotal to account for the blank value that gets counted for each group.

This will run twice as fast, since you only go through the data once.

You can use shared variables, but you would have to either create 6 different conditional totals in the subreport, and you would have to bring them back using 6 variables. Or you would have to do a linked subreport which would run 6 times, one for each group.

Ken Hamady
Crystal Reports Training/Consulting and a
Quick Reference Guide to VB/Crystal (including ADO)
 
tc3596: You may find that you cannot summarise the fields which Ken suggests you use so my idea would be to create 2 Running Totals both counting the rooms but one with the restriction formula used to evaluate when to count and the other with no restriction formula. You could then simply express RT1%RT2 to do what you want David C. Monks
david.monks@chase-international.com
Accredited Crystal Decisions Enterprise Partner
 
DCM - in my main report, it sounds like you're saying not to put the restriction in the record selection formula but instead to create to running totals and input the restriction in one of the formulas. I'll try that and I'll try Ken's as well. We need video conferencing!! Thanks for your assistance. I'll write back if that doesn't work.
 
tc3596: Correct! Don't restrict your report selection just the Running totals you would have used in the main report. Let us know how you got on - it's always good to hear when someone overcomes their problem ;-) David C. Monks
david.monks@chase-international.com
Accredited Crystal Decisions Enterprise Partner
 
DCM, thanks for the help. That worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top