Print Page | Close Window

Report Structure Problem

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=16207
Printed Date: 18 May 2024 at 2:18pm


Topic: Report Structure Problem
Posted By: lshakes
Subject: Report Structure Problem
Date Posted: 17 Apr 2012 at 1:01pm
Hi All,

I admit, I'm new to CR.  There is probably a simple solution to this issue.  I've wasted enough time on this and now I need professional help.

I have a report for work orders.  The report has a subreport for labor, equipment, and materials (In section Details a - Details c).  They all work great for showing me hours, costs and materials used.

In the report footer I have the sum of the costs from labor, equipment, and materials.  However, when I place the sum of the hours from the labor section into the report footer, it causes my report to balloon in size.  It adds data for each employee into my report.  So if there are three employees that did work in the labor section, my Work Order will be listed three different times. 

I simply want the hours spent on the work order in my report footer.  Can someone please help me?



Replies:
Posted By: lockwelle
Date Posted: 18 Apr 2012 at 3:43am
I think that you are asking how to sum the amounts from a subreport in the main report.
 
If so, shared variables is the answer. They typically come in groups of 3.
 
reset, typically in the group header
shared numbervar tot := 0;
"" //hides the output
 
increment (typically in the detail section, but for your case it might be in the subreport's report total):
shared numbervar tot;
tot := tot + {table.field} //for you it might be: tot := tot + sum({table.field});
""//again hide the output
 
display, usually in a group/report footer:
shared numbervar tot;
tot
 
 
HTH


Posted By: lshakes
Date Posted: 18 Apr 2012 at 4:47am
Thanks for the reply.  What do you mean "" hides the output?  I've tried finding this in the help files and online, but I can't find anything.  Where do I put the "" to hide the result.

Thanks


Posted By: lockwelle
Date Posted: 19 Apr 2012 at 5:25am
CR displays whatever the last value in the formula, so "" hides the output.
 
The person who taught me would make the font white and make the formula small and place it somewhere on the report.  Maintenance what a pain because you had the find the formula on the report. I found that adding a "" at the end of the formula would display nothing, so I could keep the formula large and not hide it in design time.
 
It's just a trick I've been using.
 
HTH



Print Page | Close Window