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

Formula Trouble in Subreport PLEASE HELP!!!

Status
Not open for further replies.

goodkarma

Programmer
Aug 28, 2003
17
US
I have a Crystal report version 6. The report has a subreport and in the subreport I'm getting a production efficiency based on total hours paid(in subreport) verses total hours worked(in main report) I'm passing the total hours worked in as a parameter field and am using a formula to get the efficiency. This efficiency is broken down into groups(areas). I am now trying to add up all the individual efficiency percentages for each area and get an overall efficiency percentage for the given Business Unit. For example this is one groups efficiency.
Total Hours: 1,269.25
DL Efficiency: 88.97%
So say I have 20 different areas how can I get the overall efficiency? Any help would be GREATLY appreciated!!! If I haven't described this problem well. I will try to explain it better if needed!!

Karma
 
If I understand correctly, you will need to calc overall efficiency using overall total hours worked and overall total hours paid. You should be able to do this in a formula using the sum function.

best of luck!
 
If I understand you correctly, you need the TOTAL efficiency, which would be the total hours paid / total hours worked? You can do a simple summary of total hours worked, since it is in the main report. To get Total Hours Paid, you will need to share your variable from the subreport (which is what you've done already), then create a manual running total. To do this, you'll need to take your existing variable, and rename (ie, redeclare) it, so that it doesn't get reset on every group.
Code:
WhilePrintingRecords;
Shared NumberVar YourSharedVariableName;
Global NumberVar RenameIt;
RenameIt := YourSharedVariableName

Then, in the section below that:
Code:
WhilePrintingRecords;
Global NumberVar RenameIt;
Global NumberVar RunningTotal;
RunningTotal := RunningTotal + RenameIt

Then, in your report footer (or wherever your Total Efficiency is), call the variable again:
Code:
WhilePrintingRecords;
Global NumberVar RunningTotal;
RunningTotal;

Then, use that formula in your calculation of total efficiency.

Hope that helps.

KB
 
Thank you for your suggestion. I'm getting an error when I try to put this code in as a formula. This is what I have.
WhilePrintingRecords;
Shared NumberVar ?dl;
Globel NumberVar ?newdl;
?newdl := ?dl
it points to the Shared part and then says that the remaining text does not appear to be part of the formula. So I guess I'm a little lost as to what to do next. The variable that I pass from my main report to the sub report is ?dl and so now I'm trying to pass the field that I have that takes the sum of earned hours. So that the earned hours will be passed into the subreport that has the paid hours. I hope I'm explaining myself. Let me know if you need more details.
Thanks,


Karma
 
I have fixed the error but in the formula but it still doesn't give me what I'm looking for. I'm VERY new to Crystal so I know my questions are basic. But these are the formula's that I have.
WhilePrintingRecords;
NumberVar countHrs;
if Sum ({PROD_EFF_SUBREP.L_EMPL_HRS}) <> 0 then countHrs := Sum ({PROD_EFF_SUBREP.L_EMPL_HRS})


WhilePrintingRecords;
NumberVar countHrs;
NumberVar RunningTotal;
RunningTotal := RunningTotal + countHrs


WhilePrintingRecords;
NumberVar RunningTotal;
RunningTotal;
Now, I think that I'm doing this backwards because what I really want is the sum of L_EMPL_HRS from the subreports and pass that back to the main report but when I try to sum the formula field that contains the sum of empl hours for each area it gives me an error saying it can't be summed. I have the sum of the earned hours from the main report on the main report but I don't know how to pass the empl_hrs field to the main report. Any suggestions??? anyone??


Karma
 
Ok, So I still am having a problem with this report. But it's not nearly as complex as it started. So now I have the total that I need on the main report and I have the total that I need on the subreport. My problem is I need to pass the total from the main report to the subreport with having it prompt for the value when you run the report. I'm so new to subreports that I don't know how to get it to do that. Does anyone have any suggestions?? By the way I'm running it through PeopleSoft's process scheduler on an Oracle database. I would REALLY APPRECIATE any suggestions!!
Thanks,


Karma
 
You are using Crystal Ver#6 Yes?

There was no such thing as &quot;Shared&quot; variables then At least I don't think so.

There was another function used to pass a subreport result back to the main report...I forget what it is called.

Jim Broadbent
 
Yes, I'm using Crystal 6. I got my problem figured out. I just had to change the way I linked my report to my subreport and then it worked just fine!! I just had to use my parameter field from my subreport as the field that I linked to the main report.
Thanks,


Karma
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top