syntaxcrystal-reportscrystal-reports-xi

How do I relace fields with "yes" or "no" in Crystal Reports based on whether they have a value?


All I want to do is change everything in a field that has a value to "Yes" and everything that does not have a value to "No".

I've tried this:

if {CnNote_1.CnNote_1_Description} = "" then "No" else "Yes";

But I get an error saying, "The result of selection formula must be a boolean."

If I try:

IF {CnNote_1.CnNote_1_Description} = TRUE then "Yes" else "No";

Then I get a error that says, "A string is required here."

This should be a simple thing, what am I doing wrong?


Solution

  • The formula works, I was just putting it in the wrong place.

    How I got it to work:

    I was trying to attach the formula to the CnNote_1.CnNote_1_Description field, which is wrong.

    I needed to create a New Formula Field. In the Field Explorer, right click on formula fields and click, "New..." Name the new field, paste the code in there (if {CnNote_1.CnNote_1_Description} = "" then "No" else "Yes";) then Save. Drag the new formula field into the report instead of the CnNote_1.CnNote_1_Description field, and voila.

    Copy and paste