Round value- Error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Round value- Error

big_show
Hi:
I have one problem in XFORMS.
I have this bind which is a calculation of a total.

<xforms:bind id="total" nodeset="/aval_desemp_gestao_operacional/valor_desempenho"
calculate="(0.2*instance('aval_desemp_gestao_operacional')/vdo)
        +(0.25*instance('aval_desemp_gestao_operacional')/vdr)
        +(0.25*instance('aval_desemp_gestao_operacional')/vde)
        +(0.3*instance('aval_desemp_gestao_operacional')/vdg)" />

The Field valor_desempenho is a float and I needed to round this calculation to two decimal places. Is it possible?
How can I do?
Thanks!
Reply | Threaded
Open this post in threaded view
|

RE: Round value- Error

Michael Kay-3


This mailing list is provided to allow the public to make comments on the
W3C XPath 1.0 specification, it is not an appropriate place to ask for
programming help.

A good place to ask XPath questions is the xsl-list at mulberrytech.com

The only suggestions I can make, given that XForms uses XPath 1.0, are:

(a) multiply by 100, call round(), then divide by 100.

(b) concat(substring-before(XXX, '.'), '.', substring(substring-after(XXX,
'.'), 1, 2))

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of big_show
> Sent: 12 November 2008 18:01
> To: [hidden email]
> Subject: Round value- Error
>
>
> Hi:
> I have one problem in XFORMS.
> I have this bind which is a calculation of a total.
>
> <xforms:bind id="total"
> nodeset="/aval_desemp_gestao_operacional/valor_desempenho"
> calculate="(0.2*instance('aval_desemp_gestao_operacional')/vdo)
>         +(0.25*instance('aval_desemp_gestao_operacional')/vdr)
>         +(0.25*instance('aval_desemp_gestao_operacional')/vde)
>         +(0.3*instance('aval_desemp_gestao_operacional')/vdg)" />
>
> The Field valor_desempenho is a float and I needed to round
> this calculation to two decimal places. Is it possible?
> How can I do?
> Thanks!
> --
> View this message in context:
> http://www.nabble.com/Round-value--Error-tp20465856p20465856.html
> Sent from the w3.org - www-xpath-comments mailing list
> archive at Nabble.com.
>
>
>