Print Page | Close Window

Time Elapsed

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22318
Printed Date: 27 Apr 2024 at 7:43am


Topic: Time Elapsed
Posted By: fuller31
Subject: Time Elapsed
Date Posted: 02 Jun 2017 at 6:28am
I am building a report, and part of that report needs to display the time elapsed between a unit going en route and the unit arriving. With the table I am working with, those two times are not in two separate fields. Basically, the table keeps a log - the times display in the same field but there is a new entry for every time the code is changed. The code for en route is ENRT and the code for on scene is ONSC. I cannot figure out how to make a formula that gives me how much time has elapsed between ENRT and ONSC since the field name does not change. I have a formula on another report that gives me time elapsed, but it requires two different fields. I can't figure out how to modify it to work the way I need it to.

numbervar b:= datediff( 's', {table.field1}, {table.field2});
numbervar i;
numbervar n;

i:= truncate( b/3600);
n:=(b mod 3600)/60;
totext(i,0) + 'hrs:' + totext(n,0) + 'min'


If anyone could help with the modification of the above formula, or a new formula, I would really appreciate it. Thank you!



Replies:
Posted By: DBlank
Date Posted: 02 Jun 2017 at 7:14am
do you need to do more calculations with this result or just display it in one location for each 'unit'


Posted By: fuller31
Date Posted: 02 Jun 2017 at 7:42am
Originally posted by DBlank

do you need to do more calculations with this result or just display it in one location for each 'unit'

I have attached a link to an example to clarify.

Basically, I have the report grouped by tow company. There is then a group of call numbers that each of the tow companies responded to. The problem is that the enroute and arrived times are not in two separate fields - it is the same field in the table, it's just that the code is either ENRT or ONSC. So that has been my struggle.

Basically, I want it to calculate the time for each call that each tow truck went on.

https://www.dropbox.com/s/bbl2j6p13ac3e2o/EXAMPLE.PNG?dl=0 - https://www.dropbox.com/s/bbl2j6p13ac3e2o/EXAMPLE.PNG?dl=0



Print Page | Close Window