Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: null vales in time field Post Reply Post New Topic
Page  of 2 Next >>
Author Message
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Topic: null vales in time field
     Posted: 02 Oct 2009 at 2:35pm
I have a formula:
time(0,0,0) + (Ctime({Claim.loss_time}) - (Ctime({CustomTable.time_formatted})))
But there are null values in either of the columns and while running the report, I get an error "Bad time format string"
How do I check for null values?
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Oct 2009 at 2:40pm
 NOt exactly sure hwat you are trying to do her but you can chek for null for ISNULL({table.field})
like
time(0,0,0) + ((if isnull(field) then time(0,0,0) else field) -(if isnull(field) then time(0,0,0) else field))
IP IP Logged
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 02 Oct 2009 at 3:46pm
This is what I have now, but I am still getting the error:
time(0,0,0) + ((if isnull({Claim.loss_time}) then time(0,0,0) else
ctime({Claim.loss_time})) -(if isnull({CustomTable.time_formatted}) then time(0,0,0) else ctime({CustomTable.time_formatted})))
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 02 Oct 2009 at 5:58pm
can you explain what you want to do with this formula?
IP IP Logged
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 05 Oct 2009 at 10:09am
I have two time fields one is the start of the shift and the other is the time the emnployee got injured.
I am trying to calculate the hours employee worked inthat shift before he got injured.
 
Claim.loss_time and CustomTable.time_formatted
So, when there are any null values in any of the fileds I am getting the error.
 
Thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 05 Oct 2009 at 10:29am
Try using this...
time(dateadd('n',
if isnull({Claim.loss_time}) or isnull({Claim.loss_time}) then 0 else
datediff('n',{Claim.loss_time},{Claim.loss_time}),
DATETIME(2009,01,01,00,00,00)))
 
Format it as '13:23'
IP IP Logged
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 05 Oct 2009 at 3:05pm

This doesn't work because my fields are not datetime fileds. I am getting an error that a datetime field is required.

Thanks
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 05 Oct 2009 at 3:46pm
What is the datatype of you fields? string?

Jyothi
IP IP Logged
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 05 Oct 2009 at 3:48pm
Yes. I am trying to attach a screenshot of my screen and I am not able to.
IP IP Logged
Jyothi Yepuri
Senior Member
Senior Member


Joined: 11 May 2009
Location: Australia
Online Status: Offline
Posts: 127
Quote Jyothi Yepuri Replybullet Posted: 05 Oct 2009 at 3:50pm
post sample data for your fields

Jyothi
IP IP Logged
Page  of 2 Next >>
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