Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Custom DateTime issue Post Reply Post New Topic
Author Message
RenVilo
Newbie
Newbie
Avatar

Joined: 24 May 2011
Online Status: Offline
Posts: 24
Quote RenVilo Replybullet Topic: Custom DateTime issue
    Posted: 08 Sep 2014 at 3:32am
Hi guys,

ok so I'm sitting with an issue. This is what I have:

Name    |     Delay Duration
Test1     |    4891:41
Test2     |    250:29
Test3     |    152:00

So the "Delay Duration" is a seconds field from SQL. Then I use the following to dump it into a "Time" field:

WhilePrintingRecords;
NumberVar TotalSec := {FETCHMMDELAYSMOBILEEQUIPMENT.DelayDuration} ;

NumberVar Hours   := Truncate ( TotalSec / 3600);
NumberVar Minutes := Truncate (Remainder ( TotalSec,3600) / 60);

Totext ( Hours, '00') + ':'+
Totext ( Minutes,'00')


Problem is when exporting to Excel this field is seen as text. In excel you can change the format to "h:mm" then use it in a formula. I need to set the format to "h:mm" in crystal report so that Excel can use this.

Problem is that so far the formatting in Crystal Reports resets the value if I take it to time. It doesn't show 4891:41 as hours:minutes. It only allows up to 23:59 to be shown then it resets to 00:00 and restarts the hh:mm. Is there a way to let crystal sees this as a time field but keeps the value and show more than a 24 hour clock?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 17 Sep 2014 at 5:13am
how about making it a number?
hour + (minutes/100)

you could display it the crystal either with the decimal or by using totext(someNumber, 2, "",":")

HTH
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.