Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: IF Function based on Date Post Reply Post New Topic
Author Message
MPLATTS
Newbie
Newbie


Joined: 06 Jan 2011
Location: United Kingdom
Online Status: Offline
Posts: 4
Quote MPLATTS Replybullet Topic: IF Function based on Date
     Posted: 09 Jan 2011 at 11:58pm

Hello,

I have a crystal report that has a formula in that is essentially taking two date fields away from each other {@formula}, and then returning a value depending on what the formula yeilds.

The formula is below,
 
IF {@FORMULA} = 0 THEN "Code Not Updated" ELSE totext({@UPDATED},'dd/MM/yyyy')
 
What I have noticed is the report is obviously returning data {@UPDATED} for transactions that maybe have a time difference of merely a few minutes, and I am quite happy for the time difference to be anything upto 10 hours.
 
I have tried changing the formula to read,
 
IF {@FORMULA} < 00/00/0000 10:00:00 THEN "Code Not Updated" ELSE totext({@UPDATED},'dd/MM/yyyy')
 
But this doesn't seem to have worked, I suspect my formula is now asking me if the reuslt is 10 hours less than the beginning of time!!
 
Help would be greatly appreciated!
 
Thanks
Mark Platts, Accountant, Stoke City Council
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 Jan 2011 at 4:06am

try and alter your formula to use datediff on the hour to calculate

datediff('h',datetime1,datetime2)<10 then 'Code Not Updated' else totext(datetime,'dd/MM/yyyy')
IP IP Logged
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