Calculations using xpath not working - InfoPath Dev
in

InfoPath Dev

Calculations using xpath not working

Last post 09-25-2006 08:06 AM by ckpaulie. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 09-22-2006 12:59 PM

    Calculations using xpath not working

    My form uses an xml structure similar to the following:

    <BOM>
    <Cost />
    <BOMLine>
    <Cost />
    <DesignQty />
    <Component>
    <Cost />
    </Component>
    </BOMLine>
    <BOMLine>
    <Cost />
    <DesignQty />
    <UnknownComponent>
    <Cost />
    </UnknownComponent>
    </BOMLine>
    </BOM>


    Notice that the BOMLine/Component and BOMLine/UnknownComponent are part of a choice group.

    I have tried to set the default value of the BOMLine/Cost element using the following xpath formula:

    sum(parent::BOMLine//Cost[parent::Component or parent::UnknownComponent])


    The resulting value for the BOMLine/Cost element is nothing. The only time a value is ever produced is if I hard code the default as a constant (e.g. "1").

    I looked in the manifest.xsf and I see the <xsf:calculatedField> specifed correctly in the <xsf:calculations> element. It is set to update automatically. Also, an expression box using the same formula does produce the correct values. Why is the field not being updated?

    Thanks,

    Chris
  • 09-25-2006 08:06 AM In reply to

    Re: Calculations using xpath not working

    I solved the problem but I still don't know the cause. I completely rebuilt the form from scratch; verifying that the default formulas still worked after each Data Connection, form code block, and other customization was added. I duplicated every setting I could think of and even copied the views from the orignal form into the new one. Still, the new form's calculations worked.

    Any ideas why the original template's formulas stopped calculating?

    Chris
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.