# Eval Method

Returns a Variant containing the set of results calculated when the expression is applied to each set of elements in the context.

expression.Eval(ByVal nodeList As IXMLDOMNodeList, ByVal bstrExpression as String) As Variant

expression Required. An expression that returns a reference to the Math object.

nodeList Required IXMLDOMNodeList. The node that sets the context for the expression.

bstrExpression Required String. The expression to be applied to each set of nodes in the specified context.

## Security Level

0: Can be accessed without restrictions.

## Remarks

Note This object model member 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 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

## Example

In the following example, the variable maxCost is set to the largest cost value, where cost is calculated by multiplying price by quantity.

    var nodes = XDocument.DOM.selectNodes("/my:items/my:item");
    var maxCost = XDocument.Util.Math.Max(XDocument.Util.Math.Eval(nodes, "price * quantity"));

©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