Тot calculate the value of the field...

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

Тot calculate the value of the field...

AlexFet
This post was updated on .
I have form:



Total 1 = Sum 1 + Sum 2

Sum 1 = F 1 1 + F 1 2 + F 1 3 + F 1 4

Sum 2 = F 2 1 + F 2 2 + F 2 3 + F 2 4

Sum 1 and Sum 2 calculated successfully when data in F fields entered.
But field Total 1 is not calculated after Sum 1 and Sum 2 values changed.

How I can do do that?

Form source:

...

            <xforms:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
                         ref="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" name="section-1" ref="section-1">
                    <xforms:bind name="total1" id="total1-bind" ref="total1" type="xforms:double"
                                 readonly="true()"
                                 calculate="if(normalize-space($sum1) != '' and $sum1 castable as xs:double and normalize-space($sum2) != '' and $sum2 castable as xs:double) then ($sum1 + $sum2) else 0"/>
                    <xforms:bind name="sum1" id="sum1-bind" ref="sum1" type="xforms:double" readonly="true()"
                                 calculate="if(normalize-space($f11) != '' and $f11 castable as xs:double and normalize-space($f12) != '' and $f12 castable as xs:double and normalize-space($f13) != '' and $f13 castable as xs:double and normalize-space($f14) != '' and $f14 castable as xs:double) then ($f11 + $f12 + $f13 + $f14) else ''"/>
                    <xforms:bind name="f11" id="f11-bind" ref="f11" type="xforms:double"/>
                    <xforms:bind name="f12" id="f12-bind" ref="f12" type="xforms:double"/>
                    <xforms:bind name="f13" id="f13-bind" ref="f13" type="xforms:double"/>
                    <xforms:bind name="f14" id="f14-bind" ref="f14" type="xforms:double"/>
                    <xforms:bind name="sum2" id="sum2-bind" ref="sum2" type="xforms:double" readonly="true()"
                                 calculate="if(normalize-space($f21) != '' and $f21 castable as xs:double and normalize-space($f22) != '' and $f22 castable as xs:double and normalize-space($f23) != '' and $f23 castable as xs:double and normalize-space($f24) != '' and $f24 castable as xs:double) then ($f21 + $f22 + $f23 + $f24) else ''"/>
                    <xforms:bind name="f21" id="f21-bind" ref="f21" type="xforms:double"/>
                    <xforms:bind name="f22" id="f22-bind" ref="f22" type="xforms:double"/>
                    <xforms:bind name="f23" id="f23-bind" ref="f23" type="xforms:double"/>
                    <xforms:bind name="f24" id="f24-bind" ref="f24" type="xforms:double"/>
                   
                </xforms:bind>
            </xforms:bind>

...


Reply | Threaded
Open this post in threaded view
|

Re: Тot calculate the value of the field...

Erik Bruchez
Administrator
Place the bind for total1 after the other binds and it should work.

-Erik

On Sun, Oct 7, 2012 at 7:28 AM, AlexFet <[hidden email]> wrote:

> I have form:
>
> <http://orbeon-forms-ops-users.24843.n4.nabble.com/file/n4655795/FormWithNotCalculatedField.jpg>
>
> Total 1 = Sum 1 + Sum 2
>
> Sum 1 = F 1 1 + F 1 2 + F 1 3 + F 1 4
>
> Sum 2 = F 2 1 + F 2 2 + F 2 3 + F 2 4
>
> Sum 1 and Sum 2 calculated successfully when data in F fields entered.
> But field Total 1 is not calculated after Sum 1 and Sum 2 values changed.
>
> How I can do do that?
>
> Form source in attachment.
>
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/ot-calculate-the-value-of-the-field-tp4655795.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Тot calculate the value of the field...

AlexFet
This post was updated on .
Erik, thanks a lot! That's work!

Binding of total must be placed after last field in "grand" equation - after f24.