Search code examples
crystal-reportszeronegative-number

zeros and negatives wont display


I have a report that has multiple 0 values, but instead of showing the zero, crystal shows a blank space instead. then, 2 columns over i have a field that should subtract another field from that 0 and be negative, but since the zero field is empty, it wont and the difference comes up empty two. Any idea how to fix this?

this is my code snippet for the field that has the zero:

if {fullmain.initres} > 0 
then {fullmain.initres}
else 0.00

this is my code snippet for the field that should show the difference :

if {@RESERVE} > 0 then 
{@RESERVE}-{@AMOUNT}
else 0 - {@AMOUNT}

Solution

  • place the field({fullmain.initres} and {@RESERVE}) right next to your formula and check if it is returning a null value, in this case blank. If so you might need to add and or to your if statement saying

    if isnull({fullmain.initres} <= 0 or {fullmain.initres})
    then 0.00
    else {fullmain.initres}
    
    if isnull({@RESERVE} or {@RESERVE} <= 0)
    then 0 - {@AMOUNT}
    else {@RESERVE}-{@AMOUNT}