Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Formula Field Problem Post Reply Post New Topic
Author Message
solent
Newbie
Newbie


Joined: 07 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 22
Quote solent Replybullet Topic: Formula Field Problem
     Posted: 28 May 2008 at 2:09am

Hi,

I have created a simple formula field as in the following using Basic Syntax
 
If {usp_KClubSourcing;1.Job} = "" Then
   formula ={usp_KClubSourcing;1.JobClass}
Else
   formula ={usp_KClubSourcing;1.Job}
End If
 
However, an error occurs with the highlighted text above which says:
 
A number is required here.
 
Can anybody shed some light on this.
 
Thanks
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 28 May 2008 at 4:27pm
In your database, what type of field is {usp_KClubSourcing;1.JobClass}?  What type is {usp_KClubSourcing;1.Job}?  I suspect that you have two different type fiels - possibly that one is a number and the other is a string.
 
In Crystal, you can't have two different types of data returned from an If statement in a formula - if one return value is a string, they both must be string, etc.  If it's the case that one is a number and the other is a string, you must convert the number to a string using the ToText function.  If the fields are other types, you'll need to convert one to the other's type.
 
-Dell
IP IP Logged
solent
Newbie
Newbie


Joined: 07 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 22
Quote solent Replybullet Posted: 29 May 2008 at 1:03am
Many thanks for your help.  I converted JobClass to a string using CSTR and all worked.  On looking at the backend Tables JobClass was an int so your resolution was spot on.
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