Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: IF condition help Post Reply Post New Topic
Author Message
wafaa
Newbie
Newbie


Joined: 21 Sep 2008
Location: Kuwait
Online Status: Offline
Posts: 18
Quote wafaa Replybullet Topic: IF condition help
     Posted: 13 Oct 2008 at 5:25am
When I run this condition below
if ( {EVENTS.EVENTIME} = "" ) then {@MINENTRYTIME}= 0 ;
 
it gives me this error
a date-time is required here at the empty string and the 0
 
while in the field definition for EVENTS.EVENTIME in the table design in database it's allowed to be null.
 
Please help me how should I write it?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 13 Oct 2008 at 9:59am
Null is NOT the same thing as a blank string.  And you can't assign a value to a formula from another formula.  You might edit your {@MinEntryTime} formula to add something like this:
 
if IsNull({EVENTS.EVENTIME})  then time(0,0,0)
else <the rest of your formula as it exists now.>
 
However, that may not get you the desired results.  What are you trying to do?
 
-Dell
IP IP Logged
wafaa
Newbie
Newbie


Joined: 21 Sep 2008
Location: Kuwait
Online Status: Offline
Posts: 18
Quote wafaa Replybullet Posted: 13 Oct 2008 at 10:08pm
My report is calculating the attendance of the company employees, sometimes, one of the staff forgot his id card and in that case he will not punch and the system will not record his attendance time and it will display nothing in the field as shown below, this is causing me a problem with calculating the total, so I was trying to make the report check when ever this value is null must display 0 instead in this field
 
 
Shift Starts     Entry       Mins Late      Shift Ends     Exit       Mins Early     
 
08:00am         08:30am      00:30           03:00pm     02:50         00:10
08:00am         09:09am      69:00           03:00pm     02:55         00:05
08:00am                                                 03:00pm     07:30         00:00
 
                                Total:  77:30                                        Total:00:15
 
but in other records which doesn't have empty field, the total has been calculated correctly
IP IP Logged
wafaa
Newbie
Newbie


Joined: 21 Sep 2008
Location: Kuwait
Online Status: Offline
Posts: 18
Quote wafaa Replybullet Posted: 14 Oct 2008 at 2:09am
Thanks alot I took your way and use in a different field (exit_time )and (entry_time) and it works ,it will display 0 in the min late and mins early sothat it will not affect the total
 
if IsNull {@MINENTRYTIME}  then 0
else
 <the rest of formula >
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