Skip to Content
0

If statement with multiple then not working

Nov 21, 2016 at 10:36 PM

39

avatar image

I have an IF statement in Crystal syntax that currently works:

I want to add a second THEN to one of the conditional actions.

If this

then that

and that <--add this part

Following the Help documentation in the designer I changed the code to add the second action, but I get an error message:

This makes no sense, but I humor it anyway and get another error:

I'm at a loss. Any help would be appreciated.

Leslie Bryant

Programmer/Analyst

Umpqua Community College

pic3.png (42.2 kB)
pic2.png (39.5 kB)
pic1.png (9.3 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Leslie Bryant Nov 21, 2016 at 11:25 PM
0

Thanks, Brian. Did I misunderstand the help material?

Seems like it should work based on this but obviously it won't. I thought maybe I just missed something.

Leslie


pic4.png (15.7 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Leslie,

You're syntax is correct, your use of crRed isn't. That's a formatting function and won't work in a regular formula. You have to use it in a formatting formula.

Remove the crRed from the formula and go back to a single result.

On the report designer, right-click the formula on the report and select Format Field from the menu.

Open the Font tab and click the formula button beside the Color section.

Now you can do a formula like:

If {@myFormula} = "Over" Then crRed 
Else crBlack;

You can't format the color of a font in your original formula.

Brian

0

Thanks, Brian.

This makes sense. Thanks for your help.

Leslie.

0
Brian Dong Nov 21, 2016 at 10:57 PM
0

Hi Leslie,

You're trying to format the result to red if the it returns Over? Don't do it in the formula. Instead, right-click the formula in the report designer and go to Format Object and change the font colour to Red if the formula = "Over".

Basically, you're using the crRed function incorrectly.

Good luck,

Brian

Share
10 |10000 characters needed characters left characters exceeded