kacheek Posted November 22, 2006 Share Posted November 22, 2006 i have an sql that calculates total amount for invoice, which goes like select sum(total), name,...from tbl_Xwhere .... however, i dunno how to convert amount in numerics (USD1345.00) into words (USD one thousand three hundred ...). how can i do that? btw, i'm using Oracle as my database. pls guide me step by step as i'm very new with ireport. thanks...Post edited by: kacheek, at: 2006/11/22 00:40 Link to comment Share on other sites More sharing options...
cahilla Posted November 22, 2006 Share Posted November 22, 2006 It might be easier not to use iReport to convert the number to words at all. Consider wrapping the select statement in a stored procedure that generates the figures in words and returns them in the same format as the sql select would. Then just use the procedure as a data source instead of the query. The code wouldn't be that bad. The procedure would have to:-Get each digit and its magnitude (tens, hundreds, thousands)-Get the string value of each digit/magnitude pair and stick them all together. No idea what it would look like in pl/sql, hopefully you have a DBA that can help you. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted November 22, 2006 Share Posted November 22, 2006 Use an accessor class with a static method: Code:public MyClass { public static String convertMyNumber(Double amount) { ... }} And use this expression in your TextField: Code:[code]MyClass.convertMyNumber( $F{MyAmount} ) Giulio Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now