2
我知道如何爲某些簡單值創建空值0。例如,我爲自己的文本字段中輸入以下表達式:當使用Jasper Studio時爲0時,值爲0
($V{current_val_subtotal} != null) ? $V{current_val_subtotal} : "0.00"
其中$V{current_val_subtotal}
是BigDecimal
。但我想做到以下幾點:
(($F{CurrentValue}.doubleValue()/$V{current_val_subtotal}.doubleValue())*100 != null) ? ($F{CurrentValue}.doubleValue()/$V{current_val_subtotal}.doubleValue())*100 : 「0.00」
其中$F{CurrentValue}
是BigDecimal
。
當預覽報告中,我得到了以下錯誤:
The operator != is undefined for the argument type(s) double, null
Errors were encountered when compiling report expression class file:
@DmitrySmorzhok是正確的。如果有的話,你應該在開頭檢查'($ V {current_val_subtotal}!= null)'以避免被零除。 – tobi6