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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal 8.5 - Sums on main & subreports

Status
Not open for further replies.

maruja

MIS
Feb 24, 2005
29
US
Greetings:

I am writing a report where I am doing a running total of cases for patient visits by quarter. That has worked out fine. I have summed the visits, evaluated for each record and reset on change of group which is quarter. However, I am trying to get an overall total that will carry over into my subreport. The subreport is by physicians and quarter. Can anyone advise me on how I can get this overall total to calculate? I have tried doing a running total but that does not work. I have not worked much with global/shared variables. Please advise. Thanks

 
Where is the subreport located and if it is linked, how is it linked?

-LB
 
lbass:

I'm a newbie to Crystal reports (5 months). The subreport is located in the Group header. (Is that the response you were looking for?) Also the link is on discharge quarter and DRG Code which is a code given to all discharged patients. The total I am trying to obtain is in the report footer. I have several drill downs: quarter, drg, physican, then patient level. I'm trying to carry that total in the footer all the way thru to the patient level in the subreport. Hence, I'm trying to sum a subreport. Thanks.
 
Please identify all of your groups in order (GH#1,GH#2, etc.) and then specify in which group header the subreport is located. It sounds like you have groups on quarter, drug, and physician?

-LB
 
lbass:

GH1: Discharge Quarter: This also contains the Compare Docs Subreport which is on-demand.
GH2: DRG Code.
GH3: Doctor
Details: Doctor, Patient ID, Total Charge, Length of Stay, etc.
GF3: Doctor
GF2: DRG
GF1: Discharge Quarter Running Total for visits
Report Footer: Total Running Total for overall visits
 
Still not enough information. What is in the subreport that you need in the main report? Or is it that you want data from the main report to contribute to the subreport?

Note that you won't be able to use data from an on-demand subreport in the main report. The subreport would have to be executed when the report is run for any values to be shared from it. However, you could pass data from the main report into the on-demand subreport.

It looks like you could calculate visits without the subreport by counting patient ID. Why are you using running totals instead of inserting a count?

It would probably help if you also explained the structure of the subreport as you did so nicely for the main report.

-LB
 
I have a very similar(I believe) need:

Here's my situation:

General:

The report displays details and $ totals for home inspections performed by home inspections franchisees between the 6th of the prior to the 5th of the current month.

The main report layout is as follows:

GH1: Office Id
Details: Office, Report#, Type of Inspection, Inspection Date, Inspection$
GF1: Count of Inspections, Sum of Inspection $'s, Formula to Calculated Commissions Owed.

Pretty basic stuff I know and the main report is fine.

Now the challenge is that I need to add to the commissions any additional fees that the franchisee owes for the given month that the report is being run for. These fee are housed in a separate table and a single office can owe multiple fees for any given month. My problem is how can I select, sum and add the additional fees to the commissions calculated in the main report? Perhaps a sub report is not the answer especially if I can't pass the sum of the extra fees back to the main report. Is there a solution? Any help would be greatly appreciated.


 
smueller72-Please start a new thread.

-LB
 
lbass:

The subreport has the exact same layout as the main report. My goal is this: My main report lists the top 15 DRG's by quarter by volume for the Medical Education Department. The top doc wants a sub report that compares the rest of the physician population and those same DRG's to the Medical Education Department. I had to use running totals because counts were not giving me the correct numbers for my comparative physicians. They (counts) were giving me the same numbers as my med ed docs. Running totals worked well. Now what I am trying to do is TOTAL the running total on my subreport. Is that enough data? I've tried doing a shared variable. IE: shared numbervar visits;
visits:= visits; Am I on the right track? Thanks.
 
Are you saying you are trying to total the results from each execution of the subreport in the main report footer? I'm guessing that's what you mean. First, it seems to me that if you are linking on quarter and drug code, that the subreport should be in the group#2 header (drug code). I don't think it will work correctly in the Group#1 header--it would just pick up the first drug code group, I think.

Anyway, in the subreport, create a formula:

whileprintingrecords;
shared numbervar visits := {#visits};

You must place this on the subreport in the footer. Then in the main report, in a section below the one in which the subreport is located (assuming the subreport is in GH#2b, this could be an inserted group header section GH#2b or a group footer section GF#2), add the following formula:

whileprintingrecords;
shared numbervar visits;
numbervar sumvisits := sumvisits + visits;

Then in the report footer, add this:

//{@displaytotalsubvisits}:
whileprintingrecords;
numbervar sumvisits;

You should also add a reset formula for the shared variable in a section above the one in which the subreport is located, e.g., GH#2a:

whileprintingrecords;
shared numbervar visits := 0;

This will prevent previous values from populating the sumvisits formula if the subreport doesn't execute for a particular group.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top