Rule Set Editor Dialog Box

The Rule Set Editor dialog box is used to create and modify PolicyActivity rule sets, which are serialized to a .rules file.

Note

If you want to open the .rules file with the XML Editor with encoding, you must first close the associated designer window for the workflow or activity.

For information about how to access the Rule Set Editor dialog box, see How to: Create a PolicyActivity Rule Set.

The following table describes the user interface (UI) elements of the Rule Set Editor dialog box.

UI Element Description

Add Rule

Adds a new rule definition to the rule set.

Delete

Deletes the selected rule from the rule set.

Chaining

Specifies which type of forward chaining to use with the rule set. The available options are:

  • Full Chaining, which specifies to use all forward chaining mechanisms: implicit, method attributing, and explicit using an Update function.
  • Sequential, which specifies not to use any forward chaining.
  • Explicit Update Only, which specifies to only perform forward chaining on Update actions.

For more information about forward chaining, see Using the PolicyActivity Activity.

Name

Rule set list column heading. Click to sort the list of rules by name.

Priority

Rule set list column heading. Click to sort the list of rules by priority.

Reevaluation

Rule set list column heading. Click to sort the list of rules by reevaluation type.

Rule Preview

Rule set list column heading. Click to sort the list of rules by the preview of a rule's condition and actions.

Name:

Enter the name of rule.

Priority:

Enter a priority for the rule. The default priority is 0.

Reevaluation:

Specifies which type of rule reevaluation to use with the rule. The available options are:

  • Always, which causes the rule to be reevaluated as needed.
  • Never, which causes the rule to never be reevaluated. In this case a rule executes only one time.

Active

Check to make the rule active.

Condition:

Enter an expression for the rule condition. For information about expression syntax, see the "Entering Condition and Action Expressions" section of this page.

Then Actions:

Enter expression for Then actions. For information about expression syntax, see the "Entering Condition and Action Expressions" section of this page.

Else Actions:

Enter expression for Else actions. For information about expression syntax, see the "Entering Condition and Action Expressions" section of this page.

OK

Click to save the rule set to a .rules file.

For more information about rule sets, see Using the PolicyActivity Activity.

Entering Condition and Action Expressions

You enter expressions for the Condition and the Then and Else actions as text in their respective text boxes in the Rule Set Editor dialog box. You can type this. into the editor to reference fields, properties and methods used in the workflow, using an IntelliSense-type of menu. Or you can type a workflow member name directly. You can call static methods on referenced types by typing the class name followed by the method name.

You can add logical operators to the condition, such as AND, OR, and NOT. You can also add predicates. A predicate is a binary operator and two operands. The binary operators supported are ==, >, <, >=, and <=. Supported operands are constant value, arithmetic function, and scoped public members.

You can specify the type for the comparison, and you can compare to null or an empty string. You can nest calls to members on a variable that contains a complex type, for example, this.Address.State == "WA".

Expressions support the following operators:

  • Relational operators: ==, =, !=
  • Comparison operators: <, <=, >, >=
  • Arithmetic operators: +, - , *, /, MOD
  • Logical operators: AND, &&, OR, ||, NOT, !
  • Bitwise operators: &, |

Expression operator precedence follows C# operator precedence rules.

For more information about conditions, see Using Conditions in Workflows.

Halt and Update Functions

Then Actions: and Else Actions: expressions support Halt and Update functions. To use the Halt function, type Halt into a Then Action: or Else Action: text box. The Halt action causes rule set execution to stop immediately, and control returns to the calling code. You use the Update function with forward chaining.

An Update statement can be expressed in the editor in one of two forms; both forms are shown in the following example:

Update(this.Address.State)
Update("this/Address/State")

For more information about using Update with forward chaining, see Using the PolicyActivity Activity.

See Also

Reference

Select Rule Set Dialog Box

Other Resources

PolicyActivity
Using the PolicyActivity Activity
Using Conditions in Workflows

Copyright © 2007 by Microsoft Corporation. All rights reserved.