Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Compare date/time difference Post Reply Post New Topic
<< Prev Page  of 4 Next >>
Author Message
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2012 at 10:07am
You need curly brackets around fields (like formulas)
 
totext(floor({@DateTimeRecvd})/1440,0,'') + ' days ' +
totext(
        (remainder({@DateTimeRecvd},1440)
         /60)
    ,2,''   
    ) + ' hours '
IP IP Logged
rlivermore
Groupie
Groupie


Joined: 27 Sep 2012
Online Status: Offline
Posts: 70
Quote rlivermore Replybullet Posted: 27 Sep 2012 at 10:21am

I copied and pasted the formula in your reply and am getting the same error. So close I can almost taste it )

IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2012 at 10:26am

oops...I copied and pasted something and it messed up the format. try

 
 
 
totext(floor({@DateTimeRecvd},1440)/1440,0,'') + ' days ' +
totext(
        (remainder({@DateTimeRecvd},1440)
         /60)
    ,2,''   
    ) + ' hours'
IP IP Logged
rlivermore
Groupie
Groupie


Joined: 27 Sep 2012
Online Status: Offline
Posts: 70
Quote rlivermore Replybullet Posted: 27 Sep 2012 at 10:30am
It's complaining of a missing right bracket ")" at floors
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2012 at 10:43am

it is floor , not floors

 
totext(floor({@DateTimeRecvd},1440)/1440,0,'') + ' days ' + totext((remainder({@DateTimeRecvd},1440)/60),2,'') + ' hours'
IP IP Logged
rlivermore
Groupie
Groupie


Joined: 27 Sep 2012
Online Status: Offline
Posts: 70
Quote rlivermore Replybullet Posted: 27 Sep 2012 at 10:48am
Yes sorry it was typo on my reply not the actual formula.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2012 at 10:51am
I do not get any error on the formula i posted.
try and copy and paste it again maybe?
IP IP Logged
rlivermore
Groupie
Groupie


Joined: 27 Sep 2012
Online Status: Offline
Posts: 70
Quote rlivermore Replybullet Posted: 27 Sep 2012 at 10:55am
Hmmm, copied and pasted and same issue. Is the formula version sensitive? I'm running CR 10.0 Pro.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 27 Sep 2012 at 11:02am

I thought floor was available in v10 but maybe is was added later...try using truncate instead

 
totext(truncate({@DateTimeRecvd}/1440),0,'') + ' days ' + totext((remainder({@DateTimeRecvd},1440)/60),2,'') + ' hours'


Edited by DBlank - 27 Sep 2012 at 11:02am
IP IP Logged
rlivermore
Groupie
Groupie


Joined: 27 Sep 2012
Online Status: Offline
Posts: 70
Quote rlivermore Replybullet Posted: 27 Sep 2012 at 11:10am

FYI, under math functions I do see truncate but not floor.

I tried the truncate option and it's now complaining "a number or currency amount is required here" at @DateTimeRecvd
 
IP IP Logged
<< Prev Page  of 4 Next >>
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.