TOPIC: Error scheduling report with time values

Error scheduling report with time values 05 Sep 2008 14:18 #266

  • AlexJeffery
  • AlexJeffery's Avatar
Hi

I have a crystal report which subtracts 2 time values to give the difference which is displayed in the report. I can view the report in Report Viewer but if i try and schedule it to send an email with the report as a PDF i get the following error

Specified cast is not valid. Couldn't store <30/12/1899 00:06:25> in @timetaken Column. Expected type is TimeSpan. (emailCrystalReport)

any suggestions?
The administrator has disabled public write access.

Re:Error scheduling report with time values 06 Sep 2008 02:57 #272

  • aellis
  • aellis's Avatar
It looks like somehow an invalid date is being entered into the @timetaken formula. I can't explain how it would work in the viewer and not the scheduler unless a new record was entered into the database between attempts. There must be some bad data being passed to that formula at some point - maybe a null or malformed date. Does your report have parameters? If so, be sure you have defined values for each of your parameters before scheduling (via Solution Builder) or remove the parameters entirely.
The administrator has disabled public write access.

Re:Error scheduling report with time values 08 Sep 2008 17:43 #275

  • AlexJeffery
  • AlexJeffery's Avatar
Hi

Nope no parameters at all, it is very starnge but if i schedule it to appear in the viewer up it comes with no problems at all, anything else at it seems to have serious problems. If I take out the time calculation formula it works fine. The formula is: Time({Page1s.Modified}-{@created})
The administrator has disabled public write access.

Re:Error scheduling report with time values 08 Sep 2008 18:31 #276

  • bellis
  • bellis's Avatar
Crystal can be picky with casts, especially depending on the version of Crystal you developed the original report in.

You could try throwing a isdate, isdatetime, or one of those functions to verify before casting.

Thanks!
Brian
The administrator has disabled public write access.

Re:Error scheduling report with time values 08 Sep 2008 19:11 #278

  • AlexJeffery
  • AlexJeffery's Avatar
I have run the "isTime" function and everything is reported as True. The Report was developed in Crystal 2008. I can;t understand how it will view it but not send it to a different format.
The administrator has disabled public write access.

Re:Error scheduling report with time values 08 Sep 2008 19:28 #279

  • bellis
  • bellis's Avatar
Hmm, and you are running version 1.6 of Logicity?

Do you get the same behavior if you use the datediff function instead of simply subtracting the values? We have never run across this before, but people have done very similar things with Logicity and have not seen this error pop up.

I have not done too much development in 2008 yet, I still primarily work in XI. Is {Page1s.Modified} a runtime value generated automatically in 2008?

Also when using the istime function did you try to use it in an if-then-else block to verify that the result of ({Page1s.Modified}-{@created}) is a time value before evaluating it? Something like:

if istime(({Page1s.Modified}-{@created}) ) = true then
time(({Page1s.Modified}-{@created}) )

Anytime you put explicit casts like that into a function I recommend using the evaluation function first. Depending on the report structure that function may not get evaluated until later on in the report. Does it give the same error in Viewer if you skip to the last page (which would cause all of the functions to be evaluated)? I have seen an error that occurs later pop up in export because to export, it has to run the report entirely and not just the first couple pages.

Thanks!
Brian
The administrator has disabled public write access.

Re:Error scheduling report with time values 08 Sep 2008 21:09 #280

  • AlexJeffery
  • AlexJeffery's Avatar
Thanks, I used the datediff and now it works fine.
The administrator has disabled public write access.