Solved

A Number is required here - error in Formula

Posted on 2004-08-11
3
2,257 Views
Last Modified: 2010-08-05
Hi All,
Sorry about the basic question but I am new to Crystal


I have a lot of Null entries and I wish to display a string where a entry is null.  I am tryiang the Formula below but it keeps coming back with the error message " a number is required here"

stringVar Message := "Patient to seen or time seen not recorded";

If not Isnull({@Seen Date-Time})
then
(
DateDiff ("n",{@Referral Date-Time} ,{@Seen Date-Time} )
)
else
Message;

Does anyone have any idea I might do this??

Thanks a million,
Nicky
0
Comment
Question by:NickyNin
  • 2
3 Comments
 
LVL 19

Expert Comment

by:GJParker
ID: 11774666
Your problem here is that crystal functions will only allow you to return one data type.

In your formula if the field is null then the calculation returns a number where as if the field is null you are attempting to return  a string.

One way around this would be to convert the Datediff calculation to a string i.e.

stringVar Message := "Patient to seen or time seen not recorded";

If not Isnull({@Seen Date-Time})
then
(
ToText(DateDiff ("n",{@Referral Date-Time} ,{@Seen Date-Time} ))
)
else
Message;

Gary
0
 

Author Comment

by:NickyNin
ID: 11781826
Thanks for your reply!!

Unfortunately I need the result to be a number as I then use this number in a calculation.  It tells me that the "a number is required here"

I have tried to convert it back into a number ( see Below) but I get the error message " The string is non numeric"


if IsNull ({@DateDiff})
then 0
else if ToNumber({@DateDiff}) < 10
then -6
else if ToNumber({@DateDiff}) in 10 to 60
then -5
else if ToNumber({@DateDiff}) in 60 to 120
then -4
else if ToNumber({@DateDiff}) in 120 to 240
then -3
else if ToNumber({@DateDiff}) > 240
then -2
else 0
0
 
LVL 19

Accepted Solution

by:
GJParker earned 125 total points
ID: 11781876
Try This

If IsNumeric({@DateDiff})) Then
   if ToNumber({@DateDiff}) < 10 then -6
   else if ToNumber({@DateDiff}) in 10 to 60 then -5
   else if ToNumber({@DateDiff}) in 60 to 120 then -4
   else if ToNumber({@DateDiff}) in 120 to 240 then -3
   else if ToNumber({@DateDiff}) > 240 then -2
Else
   0

Gary

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question