Search code examples
jasper-reports

how to convert String to Double in jasper Report?


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..


Solution

  • If the mktVal field is a String, you can try using Double.valueOf(${mktVal}).