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
<< Prev  Page  of 2
Author Message
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 05 Oct 2009 at 4:01pm
This is what I have for the error:
Error: bad time format string
 hoursIntoShift
{Claim.loss_time}: "12:00AM"
{CustomTable.time_formatted}:""
VAR TOS:#00:00:00#
VAR TOI: <null>
 
And here is my formula that I midified:
Local Timevar TOS := if isnull({Claim.loss_time}) then time(0,0,0) else
time(rtrim({Claim.loss_time}));
Local Timevar TOI := if isnull({CustomTable.time_formatted}) then time(0,0,0) else
time({CustomTable.time_formatted});
time(0,0,0) + ((TOS) - (TOI))
And here is the sample data:
Time_formatted:
CustomTable
time_formatted
9:00 AM
9:00 AM
8:00 AM
8:00 AM
8:00 AM
7:00 AM
6:00 PM
6:00 PM
6:00 AM
6:00 AM
6:00 AM
6:00 AM
4:15 AM
4:00 PM
4:00 AM
22:00 PM
22:00 PM
2:00 PM
2:00 PM
2:00 AM
2.00 PM
19:00 PM
12:00 PM
12:00 PM
12:00 PM
12:00 AM
12:00 AM
12:00 AM
11.00 AM
10:25 AM
10:00 PM
10:00 AM
1:00 PM
1:00 AM
1:00 AM
 
loss_time:
Claim
loss_time
12:59PM
12:59PM
12:59PM
12:59PM
12:59PM
12:58PM
12:58PM
12:58PM
12:58PM
12:58PM
12:58PM
12:58PM
12:58AM
12:58AM
12:58AM
12:58AM
12:58AM
12:57PM
12:57PM
12:57PM
12:57PM
12:57PM
12:57PM
12:57PM
12:57PM
12:57PM
12:57AM
12:57AM
12:57AM
12:56AM
12:56AM
12:55PM
12:55PM
12:55PM
12:55PM
 
Thank you!
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 4:21pm
try checking for empty string ..from above error i think your fields are string type..

Local Timevar TOS := if isnull({Claim.loss_time}) or {Claim.loss_time}="" then time(0,0,0) else
time(rtrim({Claim.loss_time}));
Local Timevar TOI := if isnull({CustomTable.time_formatted}) or {CustomTable.time_formatted} = "" then time(0,0,0) else
time({CustomTable.time_formatted});
time(0,0,0) + ((TOS) - (TOI))

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 4:36pm
Thank you, that worked like a charm. I forgot to check for empty spaces. I was just checking for nulls all the time.
Thank you :)
IP IP Logged
RTSFO
Newbie
Newbie
Avatar

Joined: 10 Sep 2009
Online Status: Offline
Posts: 36
Quote RTSFO Replybullet Posted: 06 Oct 2009 at 8:44am
I just noticed that when I do (if isnull({Claim.loss_time}) or {Claim.loss_time}="" then time(0,0,0), it defaults the time to 12:00 which messes up my calculations. How can I fix this issue??
Thanks in advance
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: 06 Oct 2009 at 2:56pm
Time(0,0,0) is 12:00 AM.

What you need to do if {Claim.loss_time} value is null or empty string??

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