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) );

Hi friends , i'm Mac i glade to be with u all

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.