Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: If Then Statement/Convert a Value Post Reply Post New Topic
Author Message
riceek
Newbie
Newbie


Joined: 20 Aug 2010
Online Status: Offline
Posts: 2
Quote riceek Replybullet Topic: If Then Statement/Convert a Value
     Posted: 20 Aug 2010 at 1:58pm
Hello:

I am working on a report to show product compatibility. In the database, a box is checked (Yes) if Product 1 is compatible with Product A; if it is not compatible, the box is left unchecked (No).

When I run the report, the compatibility comes up as 'Yes' or 'No'. I would like to run a formula in that field that converts the 'Yes' value to 'X' and the 'No' value to a blank field. The part of the formula I don't know how to write is bracketed by **, but it would be similar to:
If {productA}=Yes then **change the value in the field to X** else **leave the field blank**

Maybe this is not the right approach to the formula? I've tried IIF statements, ToText, ToWords, Replace, CStr and have not made any progress. I am pretty  handy with CReports, but I'm not exactly a formula expert.

Any help you can provide would be very much appreciated!

Thanks- E. Rice


IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 Aug 2010 at 2:30pm
If {productA}='Yes' then 'X'
IP IP Logged
riceek
Newbie
Newbie


Joined: 20 Aug 2010
Online Status: Offline
Posts: 2
Quote riceek Replybullet Posted: 23 Aug 2010 at 8:01am
DBlank-

Thanks for your suggestion. There is an error in my formula and the message I get from CR is 'A boolean is required here'. When I click ok, it puts the cursor at the '=' sign.

I've tried some similar operators and I can't seem to come up with an error free formula. Any additional suggestions?

E. Rice
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2010 at 8:05am
your putting this in the select expert.
That is only used to select a row of data based on a boolean evaluation of that row
go to the field explorer
right click on formula fields
select new
name it (e.g. Xname)
put eh formula in the box that opened
save it
drag and drop the formual field onto the detail section to see the result
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