User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Java section within the Software Development category of DaniWeb, a massive community of 423,578 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,425 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Java advertiser: Lunarpages Java Web Hosting
Views: 1180 | Replies: 3
Reply
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 100
Reputation: Kusno is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 7
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster

Jasper Report (format numeric) problem

  #1  
Apr 18th, 2008
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

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

Thanks,

Kusno.
NEVER NEVER NEVER GIVE UP
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Location: Greece
Posts: 537
Reputation: javaAddict will become famous soon enough javaAddict will become famous soon enough 
Rep Power: 3
Solved Threads: 57
javaAddict's Avatar
javaAddict javaAddict is offline Offline
Posting Pro

Re: Jasper Report (format numeric) problem

  #2  
Apr 18th, 2008
What is your code?
Do you use: resultSet.getString(); or resultSet.getDouble(); ?
Perhaps you can do this: double d = Double.parseDouble( resultSet.getString(3) );
I AM the 12th CYLON
Reply With Quote  
Join Date: Apr 2008
Posts: 1
Reputation: Mac Ebe is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Mac Ebe Mac Ebe is offline Offline
Newbie Poster

Re: Jasper Report (format numeric) problem

  #3  
Apr 18th, 2008
Hi friends , i'm Mac i glade to be with u all
Reply With Quote  
Join Date: Aug 2007
Location: Somewhere between heaven and hell
Posts: 100
Reputation: Kusno is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 7
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster

Re: Jasper Report (format numeric) problem

  #4  
Apr 20th, 2008
Originally Posted by javaAddict View Post
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..
NEVER NEVER NEVER GIVE UP
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Java Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the Java Forum

All times are GMT -4. The time now is 7:23 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC