Solved

Crystal Report Group Footer Equation

Posted on 2011-09-02
6
299 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
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…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

943 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

11 Experts available now in Live!

Get 1:1 Help Now