Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If Then Else Formula Post Reply Post New Topic
Author Message
Chris_Cook
Newbie
Newbie


Joined: 03 Sep 2012
Online Status: Offline
Posts: 3
Quote Chris_Cook Replybullet Topic: If Then Else Formula
     Posted: 03 Sep 2012 at 1:38am
Hi
 
I created a simple (i thought it was) formula for a report I made.  I just wanted it to return blank fields as a certain value:
 
IF ISNULL ({EMPLOYEE_TABLE.DISABLED}) THEN "NOBT" else {EMPLOYEE_TABLE.DISABLED}
I get the error - a string is required here - for the last field.
 
Any help would be really appreciated
 
Thanks
 
Chris
IP IP Logged
rpotts1973
Newbie
Newbie


Joined: 04 Sep 2012
Online Status: Offline
Posts: 4
Quote rpotts1973 Replybullet Posted: 04 Sep 2012 at 1:35am
Try using:
 
else
ToText({EMPLOYEE_TABLE.DISABLED})
IP IP Logged
Chris_Cook
Newbie
Newbie


Joined: 03 Sep 2012
Online Status: Offline
Posts: 3
Quote Chris_Cook Replybullet Posted: 04 Sep 2012 at 2:00am
Thank you, that worked great.  Could I ask why the totext is needed for future reference?
 
 
IP IP Logged
rpotts1973
Newbie
Newbie


Joined: 04 Sep 2012
Online Status: Offline
Posts: 4
Quote rpotts1973 Replybullet Posted: 04 Sep 2012 at 2:08am
ToText is simply used to convert any value to a text value.
IP IP Logged
Chris_Cook
Newbie
Newbie


Joined: 03 Sep 2012
Online Status: Offline
Posts: 3
Quote Chris_Cook Replybullet Posted: 04 Sep 2012 at 2:21am
That's what i thought, it just confused me as the field is already a text field.
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 04 Sep 2012 at 7:21am
Apparently {EMPLOYEE_TABLE.DISABLED} is not a string or else CR would not give that error message.
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