How to leave values in report with iReport(or TIBCO) only with 2 decimal places

Asked

Viewed 154 times

0

I wanted to make sure my real values were only 2 decimal places in my report, but I don’t know where to declare it. On my application I declared all floa typeinserir a descrição da imagem aqui

1 answer

1


Set the Pattern attribute to the textField tag:

    <textField pattern="###0.00">
        <reportElement x="437" y="462" width="100" height="20"/>
        <textElement/>
        <textFieldExpression class="java.lang.String"><![CDATA[$F{fieldFloat}]]></textFieldExpression>
    </textField>

If you are using an IDE, such as iReport, in the object properties you will get this attribute pattern with several options.

  • I am using the IDE yes, but I put this where? In XML?

  • If you can look at my picture I posted, 'cause I don’t know where to put it...

  • Oops, I’ve been away. In your image you’re highlighting the <staticText> which is (probably) the column name in the case Valor Parcela. You should put the Pattern on textField, which is the field that will actually receive the value of the plot (e.g. 50.00).

  • Since you are using iReport, in the Design tab (in the image it is in the XML), click on the field that will show the value, the properties table should appear on the right side, then just look for the Pattern property. Clicking opens a window that even has several format suggestions. I hope you’ve already found the answer, in which case, post here to help other people.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.