Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with prewritten formula Post Reply Post New Topic
Author Message
MLEstrada
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 4
Quote MLEstrada Replybullet Topic: Help with prewritten formula
     Posted: 04 Oct 2012 at 8:04am
Help! This report was written as a default from the writers of our database software but I'm getting an error that I can't figure out. Here's the formula:
 
"If (Not IsNull ({tblServiceOrders.TimeReceived})
   and Not IsNull ({tblServiceOrders.TimeRequested})) then
ReceivedToRequestedTimeAdjustment := ((ToNumber ({tblServiceOrders.TimeRequested} [12 to 13])) * 60) + ToNumber ({tblServiceOrders.TimeRequested} [15 to 16])
    - (((ToNumber ({tblServiceOrders.TimeReceived} [12 to 13])) * 60) + ToNumber ({tblServiceOrders.TimeReceived} [15 to 16]));"
 
The error is saying "A string or an array of values is requested here." for the first "ToNumber({tblServiceOrders.TimeRequested}"
 
How do I fix this?
IP IP Logged
MLEstrada
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 4
Quote MLEstrada Replybullet Posted: 04 Oct 2012 at 8:05am
Error actually says "A string or an array of values is required here." Not requested. Hehe
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 04 Oct 2012 at 9:36am
what is teh field type for tblServiceOrders.TimeRequested
IP IP Logged
MLEstrada
Newbie
Newbie


Joined: 19 Sep 2012
Online Status: Offline
Posts: 4
Quote MLEstrada Replybullet Posted: 05 Oct 2012 at 3:03am
Time Field in this format: HH:mm:ss
 
I tried removing the "ToNumber" and got the same warning.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 07 Oct 2012 at 7:21pm
Hi
DBlank asked you the field type, I doubt, the field which you are refering could be a string type or a time filed.
 
If that is a string field then try  IsNumeric() in your if condition.  If not let us know what is the field type
 
 
 
 
Thanks,
Sastry
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 09 Oct 2012 at 11:46am
Have you tried switching the AND to an OR

(Not IsNull ({tblServiceOrders.TimeReceived})
OR Not IsNull ({tblServiceOrders.TimeRequested}))
IP IP Logged
BrianJBean
Newbie
Newbie


Joined: 09 Oct 2012
Location: United States
Online Status: Offline
Posts: 3
Quote BrianJBean Replybullet Posted: 10 Oct 2012 at 2:52am
Is that the whole formula? I've noticed while working with the formulas in Crystal that you cannot mix data types. Though, changing something to a string type is fairly easy, you just start your output line with:
"", &
 
I don't remember if you need single quotes surrounding whatever is after the ampersand...but you can type it in and then try to verify if it fails, then add the single quotes
IP IP Logged
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