Solved

Crystal reports time variable to give pass or fail

Posted on 2014-03-25
4
409 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 500 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

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. …
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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