Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Bad String woes Post Reply Post New Topic
Author Message
HamGiraffe
Newbie
Newbie
Avatar

Joined: 18 Dec 2012
Location: United Kingdom
Online Status: Offline
Posts: 2
Quote HamGiraffe Replybullet Topic: Bad String woes
    Posted: 18 Dec 2012 at 4:52am
Hi there
 
I've scanned a number of sites\forums for an answers but I think my ability to articulate my issue is as impaired as my ability to write a functioning formula today.  Any guidance on the below issue would be appreicated.
 
I'm receiving a bad time format string when running one report.  The forumla it highlights as being the problem is:
 
if isnull({incident.u_duration_other_time}) then 0 else
if {@Rate} = 2 and time({incident.u_duration_other}) <= time(00,30,00) then 0.5 else
if {@Rate} = 2 and time({incident.u_duration_other}) > time(00,31,00) then 1 else 
if {@Rate} = 1 and time({incident.u_duration_other}) <= time(00,30,00) then 0.375 else
if {@Rate} = 1 and time({incident.u_duration_other}) > time(00,31,00) then 0.75 else 0
 
 
The {incident.u_duration_other} is a new field that has been added to the db and historic data has not been added for this field (therefore historically this field will be null).  This field outputs date/time (however the input options for the user only show hours, minutes and seconds - we have no interest in the date element and are looking to ignore this for the purposes of the calculation). 
 
Many thanks
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Dec 2012 at 7:11am
the standard way that I debug formula like this is to make lots of formulas that do just 1 part and display the results.
so I would probably create formulas like:
 
 time({incident.u_duration_other})
 
and of course  time(00,30,00) and  time(00,31,00)
 
then if all of this works as expected (which I'm guessing it won't) you can start combining them like:
time({incident.u_duration_other}) <= time(00,30,00)
 
time({incident.u_duration_other}) > time(00,31,00)
etc
 
this is basically the only way that i can think of to see if CR is thinking/seeing the data the same that i thought it was.
 
HTH
 
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Dec 2012 at 7:31am

i would also follow lockwelles approach.

the likely issue is the time({incident.u_duration_other}) ...
you can also use istime({incident.u_duration_other}) to do more testing. If you get any false results using this it would be an issue as the field could not be converted to a valid time in your original formula
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.