Solved

Crystal Report Group Footer Equation

Posted on 2011-09-02
6
298 Views
Last Modified: 2012-05-12
I am trying to get an equation based off the following equations:

Quantity Scrap: Sum ({LaborDistribution.QuantityScrapped},{LaborDistribution.WONumber} )
Cost Analysis Ratio: ({WOHeader.QuantityReleased}/(({@Actual Time Seconds}/60*41.58)/60))
Material Cost: {PartMaster.MaterialCost}
Total Time of scrap: Shared NumberVar scrapped_time;
whileprintingrecords;

numberVar dur := if {LaborDistribution.StartDate} <= Maximum ({@scrapped_time}) then
  scrapped_time := scrapped_time + DateDiff ("n", {LaborDistribution.StartDate}, {LaborDistribution.StopDate});
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := Truncate(Truncate(dur/60)/60);
min := Remainder(Truncate(dur/60),60);
sec := Remainder(dur,60);

hhmmss := totext(hrs,"0") + ":" + totext(min,"00") + ":"+ totext(sec,"00");



When I try and make this equation: Cost Analysis ratio + (Material Cost / Quatity Scrap) + Total Group Time Scrap


When I try this equation out it give me nothing but a blank screen ???
0
Comment
Question by:cmdolcet
  • 2
  • 2
  • 2
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 36475520
Can any of the fields be NULL?
You are subtracting in Minutes then treating it as seconds

whileprintingrecords;
numbervar scrapped_time;
numberVar dur;
if {LaborDistribution.StartDate} <= Maximum ({@scrapped_time}) then
  scrapped_time := scrapped_time + DateDiff ("s", {LaborDistribution.StartDate}, {LaborDistribution.StopDate});
dur := scrapped_time;
numberVar hrs;
numberVar min;
numberVar sec;
stringVar hhmmss;

hrs := dur \ 3600;
min := Remainder(dur,3600) \ 60;
sec := Remainder(dur,60);

hhmmss := totext(hrs,"0") + ":" + totext(min,"00") + ":"+ totext(sec,"00");

mlmcc
0
 

Author Comment

by:cmdolcet
ID: 36475611
no none of my fields can be Null
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 36476276
Did you try my new formula?

mlmcc
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:cmdolcet
ID: 36488301
In order for your equation to work I needed to add the if {LaborDistribution.StartDate} <= Maximum ({@scrapped_time}, {LaborDistribution.WONumber}) then

LabourDistribution.WONumber field.

However even with this formula in here it give me the following (see screen shot) It should add up all the time to the last scrap and after the last scrap all scrap time should be 0:00

Again this equation was placed in my details section

However in the original question I asked why I can;t use the result from the calculation for my
screen-shot.png
0
 
LVL 34

Accepted Solution

by:
James0628 earned 250 total points
ID: 36509425
First of all, just a tip.  If you look at your previous question, where we were working on that formula, there should be an "ask a related question" link/button.  You could use that to start a new question that has a link to the old one, so that people could easily refer back to the previous question if they wanted more background or to check something.

 I can't remember if you were using a group on the report or not.  If you have groups of records, like for different work orders, then Maximum ({@scrapped_time}) should probably be Maximum ({@scrapped_time}, {your group field}).

 That question aside, I think I see the reason that you're not getting 0's.  Going back to your formula in your first post, you have:

numberVar dur := if {LaborDistribution.StartDate} <= Maximum ({@scrapped_time}) then
  scrapped_time := scrapped_time + DateDiff ("n", {LaborDistribution.StartDate}, {LaborDistribution.StopDate});


 Variables default to Global, which means that they keep their values throughout the report.  So, dur is global, and when your formula doesn't set it (because the start date is after the last scrapped date), you just get the last value that was put in dur, so you get 20:04:45 repeated on each line.

 Try changing "numberVar dur" to "Local numberVar dur" (without the quotes, of course).  A local variable is re-created whenever the formula is evaluated, so if you don't set it to something else, it will be 0.

 James
0
 
LVL 34

Expert Comment

by:James0628
ID: 36509431
Oh, yeah.  Don't forget to change the "n" in the DateDiff to "s", as mlmcc mentioned.

 James
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now