Reputation: 3247
How to convert String to Double value in jasper Reports? I am having two fields in .jrxml file like below
<field name="secRate" class="java.lang.String"/>
<field name="secPrice" class="java.lang.String"/>
i need to subtract both the field
$V{Variable} = $F{secRate} - SF{secPrice}
i tried this way but not working
(new Double(Double.parseDouble($F{mktVal})))
any idea? please help me guys..
Upvotes: 1
Views: 35075
Reputation: 1
Pls try this one - ($F{PARAM}.trim().isEmpty()) ? 0.0 : new Double($F{PARAM})
Upvotes: 0
Reputation: 19
Double.parseDouble($F{PARAM})
java.lang.Double
rt.jar
(from java runtime) to classpath [Tools >> Options >> Classpath
]Upvotes: 1
Reputation: 12609
If the mktVal
field is a String, you can try using Double.valueOf(${mktVal})
.
Upvotes: 7