Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report Formula to calculate (early, late, ontime)

Status
Not open for further replies.

capronton

MIS
Jun 28, 2013
159
US
Can someone help me write formula to calculate (early, late, ontime)?

If departure time - schedule time > -30 sec then "early"
If departure time - schedule time > 300 sec then "late"
If departure time - schedule time between -30 sec and 300 sec then "ontime"

In other words if bus departs more than half-minute before schedule time "early"
If bus departs more than 5-minutes after schedule time "late"
else bus "ontime"

Can someone help me write syntax for this?

Thanks.


 
Basically you would need a if then statement using the datediff function, unfortunately I do not have time to work up the formula right now.
 
Please test thoroughly.

if datediff("s",{Scheduled},{Departed) < -30 then "Early"
else
if datediff("s",{Scheduled},{Departed}) > 300 then "Late"
else
"On Time
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top