Share via


IPMath.Avg method

Gets the average value of all numerical elements in a node set.

Namespace:  Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly:  Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)

Syntax

'Declaration
Function Avg ( _
    pxmllistInput As IXMLDOMNodeList _
) As Object
'Usage
Dim instance As IPMath
Dim pxmllistInput As IXMLDOMNodeList
Dim returnValue As Object

returnValue = instance.Avg(pxmllistInput)
Object Avg(
    IXMLDOMNodeList pxmllistInput
)

Parameters

Return value

Type: System.Object
An object that represents the average value of all the numerical elements in a node set.

Remarks

Important

This member can be accessed without restrictions.

Examples

In the following example, the variable averageAge is set to the average value of all of the numerical elements in the my:ages node set. my:ages is a simple field inside a repeating section or table.

IXMLDOMNodeList ages = thisXDocument.DOM.selectNodes("//my:ages");
   object averageAge = thisXDocument.Util.Math.Avg(ages);
   thisXDocument.UI.Alert(averageAge.ToString());

See also

Reference

IPMath interface

IPMath members

Microsoft.Office.Interop.InfoPath.SemiTrust namespace