In Crystal Reports, is it possible to have a function that returns a numeric value if the if statement evaluates to true and returns NULL otherwise?
I currently have
IF ({INDICATOR} = 'Y') Then
(
{numeric value}
)
Else
(
0
);
But since 0 is a possible value of {numeric value} it doesn't make sense. Rather, I would rather have that field come up blank if the indicator isn't 'Y', but when I replace the 0 with NULL it gives me a type mismatch error.
Is there a way for me to only show the value when the indicator is 'Y'?
If you truly want a null value and not empty try the following
create a formula called NULL then save it and close without entering any data in the formula area. Then in your formula above try
If {INDICATOR} = 'Y' then {numeric value}
else tonumber({@NULL})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With