Dear all,

I have query like this :

SELECT ID, NAME, BEGINNINGBALANCE FROM TRXBUDGET ORDER BY ID

BEGINNINGBALANCE is numeric field type in MySQL.

Jasper Report / iReport recognizes this field as String, when I change the field type to Double, raises error like these :

net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Cannot cast from String to Double value = (java.lang.Double)(((java.lang.String)field_BEGINNINGBALANCE .getValue()));//$JR_EXPR_ID=14$                         <----------------------------------------------------------------> 2. Cannot cast from String to Double                 value = (java.lang.Double)(((java.lang.String)field_BEGINNINGBALANCE .getOldValue()));//$JR_EXPR_ID=14$                         <-------------------------------------------------------------------> 3. Cannot cast from String to Double                 value = (java.lang.Double)(((java.lang.String)field_BEGINNINGBALANCE .getValue()));//$JR_EXPR_ID=14$                         <----------------------------------------------------------------> 3 errors

What should I do to change the format ?
I think I should use Text Field Expression, but I dont know how to do that :sad:

and.. I also want to format it to be "##,###,###.#0"

Thanks,

Kusno.

What is your code?
Do you use: resultSet.getString(); or resultSet.getDouble(); ?
Perhaps you can do this: double d = Double.parseDouble( resultSet.getString(3) );

What is your code?
Do you use: resultSet.getString(); or resultSet.getDouble(); ?
Perhaps you can do this: double d = Double.parseDouble( resultSet.getString(3) );

Hi..
the code is for Jasper Report not in Java GUI.

Thanks,

Cause-NO..

This article has been dead for over six months. Start a new discussion instead.