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>
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!
2 Answers:
Posted on June 21, 2014 at 10:10am
Well, I solved my own issue using MySQL statement instead of properties from iReport. My solution was an adaptation from this site (Pt-BR):
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.
.jpg)
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.