ConditionSet Class

This object represents a Condition Set used for a Process Director object.

Properties

PROPERTY NAME

DATA TYPE

DESCRIPTION

ID

String

The string ID of the ConditionSet.

In addition to Properties, Condition Sets use the SystemVariableContext object to specify the various context properties for the Condition Set. Please see the SystemVariableContext topic for more information. Additionally, the Condition struct object is required as a parameter for some methods of this class. The Condition struct is documented below.

Methods

Condition Struct

The Condition Struct object is an IEnumerable object that stores a condition or set of conditions.

Properties

These properties can be enumerated via a Get, but are Set privately, and can't be Set in script.

PROPERTY NAME

DESCRIPTION

Left

A SystemVariable object that defines the Left side of the condition.

Right

A SystemVariable object that defines the Right side of the condition.

Type

The type of comparison to make between the left and right side of the Condition.

Methods

Code Sample

A user can't instantiate a ConditionSet (or a Condition) object. Users will only interact with these objects through the “ReturnValues” property of a Business Rule. The following code evaluates a Business Rule, and then manually evaluates its return values, returning the first match:

var context = new SystemVariableContext {Form = BaseForm};
var sv = new SystemVariable(bp.eSysVar.FormField,
    new DataItem(FormEnums.eDataType.String),
    {String = "UserPicker1"});
sv.Parameters["format"] = "uid";
var sEval = sv.Evaluate(context);

var rule = Rule.GetRuleByRULEID(bp, "RULEID");
var resultRule = rule.Evaluate(context);

ReturnFirst(rule, context);

// Return the First matching value in a Rule
static string ReturnFirst(Rule rule, SystemVariableContext context)
{
    foreach(var rv in rule.ReturnValues)
    {
        // The Copy below function is unnecessary, and added only for illustration.
        // In actual use, the line below would simply be:
        // var cs = rv.Value();

        var cs = rv.Value.Copy();
        if (cs.Evaluate(context))
         return rv.Key.Evaluate(context);
    }
    return "";
}