Reputation: 21
I have a BigDecimal variable that contains number with minus(-) and not. I want to put static text that should be match with this conditions:
For example, if $V{saldo} = -250000
then the static text should be "Rugi"
, and if $V{saldo} = 400000
then the static text should be "Laba"
Upvotes: 0
Views: 7078
Reputation: 896
First Check for ZERO then apply your logic
$V{saldo}.$V{saldo} != 0.0 ? ($V{saldo}.intValue() < 0 ? "Rugi" : "Laba"): "Zero"
Upvotes: 1
Reputation: 520878
Try using this if-else construct:
$V{saldo}.intValue() < 0 ? "Rugi" : "Laba"
Please see this SO post for more information.
Upvotes: 1