Share via


ValueExpressionType

Applies To: System Center 2012 - Operations Manager, System Center 2012 R2 Operations Manager, System Center 2012 SP1 - Operations Manager

The ValueExpressionType complex data type is used to define the left and right values of a comparison operation.

The ValueExpressionType data type is generally used from within the SimpleCriteriaType schema data type.

Schema Definition

<xsd:complexType name="ValueExpressionType">
  <xsd:choice>
    <xsd:element name="XPathQuery" type="XPathQueryValueType"/>
    <xsd:element name="Value" type="ConstantValueType"/>
  </xsd:choice>
</xsd:complexType>

Remarks

The ValueExpressionType data type contains only one of the two the parameters described in the following table.

Parameter Type Description

XPathQuery

Complex

The XPath to an element in the incoming data item’s XML content.

Value

Complex

A constant string value or a $Target or $Config reference.

XPathQuery

When the XPathQuery element is defined, the value expression type implicitly configures the module to look inside the data item, so the $Data reference is not required. This is the only module type that does not require $Data syntax.

The following code is a simple example that compares the PublisherName of the incoming data item (a Windows event, in this example) to a static value of EventCreate:

<Expression>
  <SimpleExpression>
    <ValueExpression>
      <XPathQuery>PublisherName</XPathQuery>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
      <Value>EventCreate</Value>
    </ValueExpression>
  </SimpleExpression>
</Expression>

It is valid to use XPathQuery or Value expressions on the left side or right side of the comparison, as required. For example, the preceding example could also be written as follows:

<Expression>
  <SimpleExpression>
    <ValueExpression>
      <Value>EventCreate</Value>
    </ValueExpression>
    <Operator>Equal</Operator>
    <ValueExpression>
      <XPathQuery>PublisherName</XPathQuery>
    </ValueExpression>
  </SimpleExpression>
</Expression>

It is possible to cast the value expressions to an appropriate type for comparison. The allowed type casts are as follows:

  • Boolean

  • Integer

  • UnsignedInteger

  • Double

  • Duration

  • DateTime

  • String

The following example forces an Integer comparison:

<Expression>
  <SimpleExpression>
    <ValueExpression>
      <XPathQuery Type="Integer">Params/Param[1]</XPathQuery>
    </ValueExpression>
    <Operator>LessEqual</Operator>
    <ValueExpression>
      <Value Type="Integer">102</Value>
    </ValueExpression>
  </SimpleExpression>
</Expression>

If the value cannot be converted to the requested type, an error event that describes the problem is logged to the local Operations Manager event log. The left side and right side of the expression should be cast to the same value type, or it might not be possible to evaluate the expression.

Information

   

Schema Type

System.ExpressionEvaluatorSchema

Library

System.Library