?
Solved

Crystal reports time variable to give pass or fail

Posted on 2014-03-25
4
Medium Priority
?
410 Views
Last Modified: 2014-04-13
Hey,
I need to add a pass or fail to a report contingent upon a tech arriving on site within a specific time frame.
Example:

if {TIMESTMP.STATUS} = 50 (this is "arrived") and {TIMESTMP.TIMEENTER} (this gives actual time stamp of his arrival)  is LESS THEN or EQUAL to 4 hours from {TIMESTMP.STATUS} = 1 (this is when the ticket was created) then give me "PASS" ELSE "FAIL"
0
Comment
Question by:mikeg95
[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
4 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 1500 total points
ID: 39953961
I assume you have separate records for each status.
You need to group the report on the TicketID

Try this

In the report header and group header add a formula
Name - DeclVars
WhilePrintingRecords;
Global DateTimeVar TicketStart;
Global DateTimeVar TechArrived;
Global BooleanVar TechHasArrived;

TechHasArrived := False;
""

Open in new window

In the detail section add a formula
Name - SetTimes
WhilePrintingRecords;
Global DateTimeVar TicketStart;
Global DateTimeVar TechArrived;
Global BooleanVar TechHasArrived;

If {TIMESTMP.STATUS} = 1 then
    TicketStart := {TIMESTMP.TIMEENTER}
Else If {TIMESTMP.STATUS} = 50 then
(
    TechHasArrived := True;
    TechArrived:= {TIMESTMP.TIMEENTER};
);
""

Open in new window

In the group footer add a formula
Name - DisplayArrivedOnTime

WhilePrintingRecords;
Global DateTimeVar TicketStart;
Global DateTimeVar TechArrived;
Global BooleanVar TechHasArrived;
Local StringVar strOut;

If Not TechHasArrived then
    strOut := "No Tech"
Else If DateDiff('h',TicketStart,TechHasArrived) <= 4 then
    strOut := "Pass"
Else
    strOut := "Fail";
strOut

Open in new window



mlmcc
0
 
LVL 35

Expert Comment

by:James0628
ID: 39955568
Is TIMEENTER a datetime, or just a time?

 If it's just a time, mlmcc's second formula will need to be changed.

 Also, if it's just a time, can the time span include midnight?  For example, could STATUS 1 be at 11 PM and STATUS 50 be at 2 AM (3 hours later)?

 James
0
 

Assisted Solution

by:mikeg95
mikeg95 earned 0 total points
ID: 39956094
Hey mlmcc's Formula let me in the right direction but I was able to get this done a bit differently the field is just time. thanks for your input.
here is how it worked out. I separated the two times.

If {@Priority} = "P2" and  {@Settimes}- {@AArriveTime} <= 4 then

    "Pass"
Else IF {@Priority} = "P2" and  {@Settimes}- {@AArriveTime} >= 4 then
    "Fail"
Else ""
0
 

Author Closing Comment

by:mikeg95
ID: 39997124
thanks for your answers I would not have arrived to the conclusion without them
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

762 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