Solved

Crystal reports time variable to give pass or fail

Posted on 2014-03-25
4
407 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 100

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

726 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