Question about Calculation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Question about Calculation

nelsontsang
Hello all,

I would like to have a subtotal in each repeat line item the xhtml code as below:

<xforms:header>
<xforms:bind id="linetotal" nodeset="ChargeAmount" calculate="Quantity * Amount" />
</xforms:header>
:
:
<xforms:repeat model="model_Document" id="repeat_LineItem_model_Document" nodeset="/Document/Body/PurchaseOrder/LineItem">
:
<xforms:output ref="ChargeAmount" model="model_Document" xxforms:format="format-number(.,'####,####0.##')">
      <xforms:label>Charge Amount</xforms:label>
</xforms:output>
:
</xform:repeat>
:
:

however, it cannot auto update the value of ChargeAmount when I change the value of Quantity or Amount. Please advise anything I have done wrong?

Thanks a lot!!



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Question about Calculation

nelsontsang
problem solved,
thanks a lot.

On 12/20/06, [hidden email] <[hidden email]> wrote:
Hello all,

I would like to have a subtotal in each repeat line item the xhtml code as below:

<xforms:header>
<xforms:bind id="linetotal" nodeset="ChargeAmount" calculate="Quantity * Amount" />
</xforms:header>
:
:
<xforms:repeat model="model_Document" id="repeat_LineItem_model_Document" nodeset="/Document/Body/PurchaseOrder/LineItem">
:
<xforms:output ref="ChargeAmount" model="model_Document" xxforms:format="format-number(.,'####,####0.##')">
      <xforms:label>Charge Amount</xforms:label>
</xforms:output>
:
</xform:repeat>
:
:

however, it cannot auto update the value of ChargeAmount when I change the value of Quantity or Amount. Please advise anything I have done wrong?

Thanks a lot!!




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws





--
--
Nelson.
[hidden email]

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Question about Calculation

Alessandro  Vernet
Administrator
In reply to this post by nelsontsang
The bind looks incorrect:

<xforms:bind id="linetotal" nodeset="ChargeAmount" calculate="Quantity
* Amount" />

The expression in "calculate" evaluates relative to ChargeAmount, so
as it is right now it will look for child elements Quantity and
Amount. Maybe instead you want to have: ../Quantity * ../Amount.

Alex

On 12/19/06, [hidden email] <[hidden email]> wrote:

> Hello all,
>
> I would like to have a subtotal in each repeat line item the xhtml code as below:
>
> <xforms:header>
> <xforms:bind id="linetotal" nodeset="ChargeAmount" calculate="Quantity * Amount" />
> </xforms:header>
> :
> :
> <xforms:repeat model="model_Document" id="repeat_LineItem_model_Document" nodeset="/Document/Body/PurchaseOrder/LineItem">
> :
> <xforms:output ref="ChargeAmount" model="model_Document" xxforms:format="format-number(.,'####,####0.##')">
>       <xforms:label>Charge Amount</xforms:label>
> </xforms:output>
> :
> </xform:repeat>
> :
> :
>
> however, it cannot auto update the value of ChargeAmount when I change the value of Quantity or Amount. Please advise anything I have done wrong?
>
> Thanks a lot!!
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet