0

値を計算した他のコントロールによって値を計算したテキスト出力コントロールを含むフォームを作成しました。問題は、(ビルダーからの) テスト モードでは、これらのコントロールが正常に機能していることです。ランナーでは、これらのコントロールは常に 0 (空) です。ドキュメントを保存して再度開くと、値は正しくなりますが、更新されません。

これが私のインスタンスです:

<xforms:instance id="fr-form-instance">
    <form>
        <section-1>
            <first>
                <first_amount/>
                <first_percent/>
                <first_total/>
            </first>
            <second>
                <second_amount/>
                <second_percent/>
                <second_total/>
            </second>
            <third>
                <third_amount/>
                <third_percent/>
                <third_total/>
            </third>
            <total/>
            <average/>
        </section-1>
    </form>
</xforms:instance>

そして私のバインディング:

<xforms:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
             nodeset="instance('fr-form-instance')">
    <xforms:bind id="section-1-bind" name="section-1" ref="section-1">
        <xf:bind name="first" id="first-bind" ref="first">
            <xf:bind name="first_amount" id="first_amount-bind" ref="first_amount"
                     type="xf:decimal"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="first_percent"
                     id="first_percent-bind"
                     ref="first_percent"
                     type="xf:decimal"
                     constraint="./text()&gt;=0 or string-length(./text())=0"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="first_total"
                     id="first_total-bind"
                     ref="first_total"
                     calculate="(../first_amount/text() * ../first_percent/text()) div 100"
                     type="xf:decimal"/>
        </xf:bind>
        <xf:bind name="second" id="second-bind" ref="second">
            <xf:bind name="second_amount" id="second_amount-bind" ref="second_amount"
                     type="xf:decimal"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="second_percent"
                     id="second_percent-bind"
                     ref="second_percent"
                     type="xf:decimal"
                     constraint="./text()&gt;=0 or string-length(./text())=0"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="second_total"
                     id="second_total-bind"
                     ref="second_total"
                     calculate="(../second_amount/text() * ../second_percent/text()) div 100"
                     type="xf:decimal"/>
        </xf:bind>
        <xf:bind name="third" id="third-bind" ref="third">
            <xf:bind name="third_amount" id="third_amount-bind" ref="third_amount"
                     type="xf:decimal"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="third_percent"
                     id="third_percent-bind"
                     ref="third_percent"
                     type="xf:decimal"
                     constraint="./text()&gt;=0 or string-length(./text())=0"/>
            <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="third_total"
                     id="third_total-bind"
                     ref="third_total"
                     calculate="(../third_amount/text() * ../third_percent/text()) div 100"
                     type="xf:decimal"/>
        </xf:bind>
        <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="total"
                 id="total-bind"
                 ref="total"
                 calculate="sum(instance('fr-form-instance')/section-1/first/first_total/text()) + sum(instance('fr-form-instance')/section-1/second/second_total/text()) + sum(instance('fr-form-instance')/section-1/third/third_total/text())"
                 type="xf:decimal"/>
        <xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="average"
                 id="average-bind"
                 ref="average"
                 type="xf:decimal"
                 calculate="instance('fr-form-instance')/section-1/total/text() div (count(instance('fr-form-instance')/section-1/first) + count(instance('fr-form-instance')/section-1/second) + count(instance('fr-form-instance')/section-1/third))"/>
    </xforms:bind>
</xforms:bind>
4

1 に答える 1

1

これは、テスト モードとフォームのデプロイ時の両方で、提供されたフォームで機能するようです (スクリーンショットを参照)。Orbeon Forms 4.1 を使用しています。

重要ではありませんが、XPath 式に関するいくつかのコメントを以下に示します。

  • text()XPath で必要になることはほとんどなく/text()、式からそのような出現箇所をすべて削除できます。
  • の代わりに、より読みやすい演算子&gt;=を使用できますge

スクリーンショット.

于 2013-04-24T07:31:27.923 に答える