×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Running total on variable

Running total on variable

Running total on variable

(OP)
I'm using Crystal Reports 2016 and I'm having a problem with displaying the calculated running total in the report footer. As long as I don't Hide or Suppress the Detail or Group footer all of the formulas calculate correctly. If I Hide or Suppress the Detail or Group footer (which is what I want to do) the running calculation displays a value that doesn't make any sense. I'll describe the report structure and formulas as best I can below.

The main report has three tables Job, Job_Operation and Job_operation_Time
There is one Subreport which has one table Job_Operation the subreport is linked to the main report by the Job field. I'm using the Job Operations subreport to find the Max job.sequence I pass that value to the main report. The subreport is in Details B section, all the of other fields are in Details A section. The Scrap Cost Each formula is in Group 1 footer.

Group 1 = Job
Group 2 = Work Center

Below are the formulas I'm using to calculate the the scrap cost for each detail line,

CODE

whileprintingrecords;
shared currencyvar ScrapCost :=
scrapcost + 
(if {Job_Operation.Sequence}=0
then
({@LineCostEa}*(({Job_Operation.Sequence}+1)/({@Pass_JobOpSeq}+1)))*{Job_Operation_Time.Act_Scrap_Qty}
else
if {@Pass_JobOpSeq}=0
then
({@LineCostEa}*(({Job_Operation.Sequence}+1)/({@Pass_JobOpSeq}+1)))*{Job_Operation_Time.Act_Scrap_Qty}
else
({@LineCostEa}*({Job_Operation.Sequence}/{@Pass_JobOpSeq}))*{Job_Operation_Time.Act_Scrap_Qty}) 

Below is the formula I using to create a running total for the scrap cost.

CODE

whileprintingrecords;
shared currencyvar ScrapCost :=
scrapcost + 
(if {Job_Operation.Sequence}=0
then
({@LineCostEa}*(({Job_Operation.Sequence}+1)/({@Pass_JobOpSeq}+1)))*{Job_Operation_Time.Act_Scrap_Qty}
else
if {@Pass_JobOpSeq}=0
then
({@LineCostEa}*(({Job_Operation.Sequence}+1)/({@Pass_JobOpSeq}+1)))*{Job_Operation_Time.Act_Scrap_Qty}
else
({@LineCostEa}*({Job_Operation.Sequence}/{@Pass_JobOpSeq}))*{Job_Operation_Time.Act_Scrap_Qty}) 

Below is the formula to display the running total in the Report Footer.

CODE

whileprintingrecords;
shared currencyvar scrapcost 

Hopefully I gave enough information, if I didn't please let me know.
Thank you for your help!

RE: Running total on variable

(OP)
Sorry everyone, I noticed this morning that I posted the same formula twice. The formula for the Scrap Cost for each line is wrong in the above post.

Below is the correct Scrap Cost for each detail line.

CODE

(({Job.Est_Labor}+{Job.Act_Material}+{Job.Act_Service})/{Job.Make_Quantity}) 

RE: Running total on variable

It appears the problem would be resolved if you could just make the subreport disappear. You can't suppress the subreport directly or the section it is in directly, because then the shared variable won't pass, but you can do the following:

Within the subreport, suppress all sections. In the main report, check "suppress blank subreport" (format->subreport->subreport tab), remove the borders from the subreport (select the subreport->format->borders and change to "no line" for each edge), and in the section expert, format detail_b to "suppress blank section".

-LB

RE: Running total on variable

(OP)
Thank you lbass, that works perfectly!

I did make one change because I want to hide the detail section. I moved the subreport to Group Footer 2.

Thank you for your help!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close