Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: A Time problem... Post Reply Post New Topic
Author Message
Slurm
Newbie
Newbie
Avatar

Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote Slurm Replybullet Topic: A Time problem...
    Posted: 29 Jan 2009 at 11:24am
Hey all, I'm running Crystal 10 and am having a problem with creating a formula. The problem is probably simple for you guys, but my Crystal-Fu is weak.
 
This is what I got:
 
IF {WO.DateClosed} - {WO.DateCreated} <  (???) then true and
IF {WO.DateClosed} - {WO.DateCreated} >  (???) then false
 
In place of the ??? id like to have 24 hours so I can show anything that was completed within 24 hours of the creation date.
 
Make sense?
 
I can't seem to get anything to work, but I think its to do with the fact that I want to do greater than and less than with dates. Is this a no no?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 29 Jan 2009 at 11:39am
if datediff("h",{WO.DateClosed},{WO.DateCreated})<24 then True else False
 
Your second portion is assumed as false because the only thing left is =>24 if the first part is not met.
Make sure you are handling =24 in the right place for your condition to be accurate based on what you want it to do. I assumed =24 should be false in the above


Edited by DBlank - 29 Jan 2009 at 11:41am
IP IP Logged
Slurm
Newbie
Newbie
Avatar

Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote Slurm Replybullet Posted: 30 Jan 2009 at 4:17am
That got me pointed in the right direction! Only problem was that, for some reason, it returned everything as true.
 
Instead I just did a datediff to give me the hours, and then a seperate formula for the true false argument. It works!
 
thanks a bunch!
 
 
IP IP Logged
Slurm
Newbie
Newbie
Avatar

Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote Slurm Replybullet Posted: 30 Jan 2009 at 5:32am
Now I have a new problem...
 
Is there any way to do a count my "true" returns but leave ALL the returns so I can also do a count of the total? I'm trying to get a percentage of true's.
 
Make sence? 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 30 Jan 2009 at 5:55am
Yup can do this two ways.
Use a running total as a Count of your true formula conditionally counted as field= true
Or
Make another formula the same as your true but change it to if then 1 else 0 and then insert a summary function on that as a SUM.

Edited by DBlank - 30 Jan 2009 at 5:59am
IP IP Logged
Slurm
Newbie
Newbie
Avatar

Joined: 07 Nov 2007
Location: United States
Online Status: Offline
Posts: 8
Quote Slurm Replybullet Posted: 30 Jan 2009 at 6:50am
Woohoo!
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.