Show All

# calculations Element

Contains definitions for calculations performed in the form and specifies how blank values are handled.

## Type

`xsd:complexType`

## Child Elements

Element | Description
--- | ---
calculatedField | Defines an individual calculation, including the formula, when the calculation is to be performed, and where the result will be stored.

## Attributes

Attribute | Type | Required | Description | Possible Values
--- | --- | --- | --- | ---
treatBlankValueAsZero | `xsf:xdYesNo` | No | Specifies whether a blank field should be calculated with a value of zero. Default is yes. | yes no

## Definition

    <xsd:element name="calculations">
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element ref="xsf:calculatedField" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attribute name="treatBlankValueAsZero" type="xsf:xdYesNo" use="optional"></xsd:attribute>
      </xsd:complexType>
    </xsd:element>

## Remarks

Every calculation in the form will have a calculatedField element.

Note This item is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Editions Service Pack 1 or later is not installed. Any form defined by a form definition file (.xsf) that includes this item cannot be opened in InfoPath when service pack features are disabled or unavailable.

## Example

The following is an example of the calculations element:

    <xsf:calculations>
     <xsf:calculatedField
      target="/my:myFields/my:average"
      expression="xdMath:Avg(../my:expenses/my:expense/my:amount)"
      refresh="onChange" />
    </xsf:calculations>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp