Reputation: 534
I want to do an IF statement that has 2 outcomes:
For example:
IF {Command.Check in/Appt} < 0
THEN "Early" AND crGreen
ELSE "LATE" AND crRed
In the above example the AND
does not work.
A Boolean is required here.
So I just need to find a way to have those 2 outcomes
Upvotes: 1
Views: 311
Reputation: 3680
Short of using shared variables, you can't do that. One formula, one output.
But there's nothing saying you can't have two nearly identical formulas, (One for Early
/Late
, one for Red
/Green
) - And in Crystal, that's the best way to do it. (Glad to see you figured that out on your own.)
The reason the AND
keyword was giving you trouble is because AND
is a Boolean operator. Whenever you use AND
, you're basically using this function:
Take booleans
FOO
andBAR
as input.I return
true
if, and only if,FOO
andBAR
are both true.
If at least one of them is false, I returnfalse
.
So the AND
keyword was expecting two booleans for input. Instead you gave it a string and a color. Ask a machine if the color Red is equal to true, it's going to complain.
Upvotes: 1
Reputation: 534
Ok, while I didn't find a solution by adding it in the formula, I did find a solution.
For those who have the same problem, just keep the IF
statement:
IF {Command.Check in/Appt} < 0
THEN "Early"
ELSE "LATE"
Then save and go to Format
> Highlight Expert
to enter the formatting conditions you like.
In the above case, I did:
New
> Value of:
this field
is equal to
"Early" Font color
Green New
> Value of:
this field
is equal to
"Late" Font color
RedUpvotes: 0