Solved

Crystal reports time variable to give pass or fail

Posted on 2014-03-25
4
399 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
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
Comment Utility
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 34

Expert Comment

by:James0628
Comment Utility
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
Comment Utility
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
Comment Utility
thanks for your answers I would not have arrived to the conclusion without them
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 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

15 Experts available now in Live!

Get 1:1 Help Now