Round value- Error

View: New views
2 Messages — Rating Filter:   Alert me  

Round value- Error

by big_show :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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!

RE: Round value- Error

by Michael Kay-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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: www-xpath-comments-request@...
> [mailto:www-xpath-comments-request@...] On Behalf Of big_show
> Sent: 12 November 2008 18:01
> To: www-xpath-comments@...
> 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.
>
>
>