Jump to content

Two decimals in Float


Ajenjo

Recommended Posts

Hi.

 

I have two variables to sum two fields in FLOAT.

 

Code:

(...)
<variable name="precio_total" class="java.lang.Float" resetType="Group" resetGroup="AlbaranGrupo" calculation="Sum">
<variableExpression><![CDATA[$F{precio}]]></variableExpression>
<initialValueExpression><![CDATA[new java.lang.Float(0)]]></initialValueExpression>
</variable>
<variable name="importe_total" class="java.lang.Float" resetType="Group" resetGroup="AlbaranGrupo" calculation="Sum">
<variableExpression><![CDATA[$F{importe}]]></variableExpression>
<initialValueExpression><![CDATA[new java.lang.Float(0)]]></initialValueExpression>
</variable>
(...)

 

And I want to put these numbers with two decimals.

 

Example .- 12.60, 34,35, 4,00...

 

What's the way?

 

And how can I do this.-

 

Code:
[code]
<variable name="precio_total" class="java.lang.Float" calculation="Sum">
<variableExpression><![CDATA[($F{precio}.floatValue() * $F{cantidad}.floatValue())]]></variableExpression>
<initialValueExpression><![CDATA[new java.lang.Float(0)]]></initialValueExpression>
</variable>

 

That's, other operations with fields available.

 

Thanks

Post edited by: Ajenjo, at: 2008/03/27 09:59

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...