adan.ribeiro Posted June 21, 2014 Share Posted June 21, 2014 Hi!I am using iReport Designer 5.5.1 with PHPJasperXML.I developed a simple report with four columns where one of them shows up some values in Brazilian currency, but it didn't work. The report only prints the number without any aditional symbol. Well, I've tried to format this one with the following code:<textField pattern="¤ #,##0.00"> <reportElement x="98" y="0" width="76" height="20" uuid="fc59b1a9-2fb7-4557-9e3c-9a54c79dd8b0"/> <textElement textAlignment="Right"/> <textFieldExpression><![CDATA[$F{Valor}]]></textFieldExpression> </textField>[/code]MySQL has this field set as FLOAT (10,2), so do I checked for the same value in properties panel and I figured out that EXPRESSION CLASS property was set as "java.lang.string". I've changed this one to "java.lang.float" but nothing happened. I really appreciate any help with it. Thanks! Link to comment Share on other sites More sharing options...
Solution adan.ribeiro Posted June 21, 2014 Author Solution Share Posted June 21, 2014 Well, I solved my own issue using MySQL statement instead of properties from iReport. My solution was an adaptation from this site (Pt-BR): http://paposql.blogspot.com.br/2011/12/funcao-para-formatar-moeda-em-reais-no.html Then I just replaced the value in the sentence by field "valor_aquisicao" like this: SELECT CONCAT('R$ ',REPLACE(REPLACE(REPLACE(FORMAT(valor_aquisicao, 2), '.', '|'), ',', '.'), '|', ',')) AS 'Valor' FROM [...rest of statement...] It suited very well and fixed my problem. as you can see in this image below. Link to comment Share on other sites More sharing options...
htshozawa Posted June 22, 2014 Share Posted June 22, 2014 I'm using Japanese currency and everything works fine. I've just used Unicode characters in my pattern.UMaking your sql complex reduces portability and decrease performance. Link to comment Share on other sites More sharing options...
adan.ribeiro Posted July 3, 2014 Author Share Posted July 3, 2014 I also use Unicode and appropriated regional settings, but this wasn't show itself a good shot. I agree with you that to reduce the complexity of my statement will better the performance but I still have not found any other good option for it. 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