Solved

Crystal Report Group Footer Equation

Posted on 2011-09-02
6
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 101

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 101

Expert Comment

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

mlmcc
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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 35

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 35

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

623 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