Multiple conditions for a signle rule

I'm working with the External Ruleset Example (great sample!) and the Ruleset Editor.

The Ruleset sample executes rules I create using the Ruleset Editor except when a rule has multiple conditions. For example, I have a rule that's something like this:

Condition: this.Color.isGreen && this.Shape.isRound && this.is3DObject
Action: this.Helper.AddItem("This is a green ball")

The problem is that the action fires whenanyof the three boolean "is" properties are true. Using the && operator, I want the Action to fire when all of the properties are true. I tried the following:

* Converted the && operators to & operators
* Converted the && operators to 'AND' operators
* Rephrased the rule in several ways
* Changed the rule's priority
I always get the same result - the action fires when any of the condition's properties are true.

What am I missing? Wrong condition syntax? Does the Ruleset Editor correctly express the AND condition?

Thanks,

Erik

[1053 byte] By [ErikWestermann] at [2008-2-13]
# 1
Erik,

Thanks for the feedback on the sample.

Your syntax is fine, and I'm not able to recreate your problem. If you look at the file created by the editor you should see something like the following for the RuleCondition. Notice the nested CodeBinaryOperatorExpessions with a BooleanAnd operator. What do you see for your condition?

<ns0:Rule.Condition>
<ns0:RuleExpressionCondition Name="">
<ns0:RuleExpressionCondition.Expression>
<ns2:CodeBinaryOperatorExpression Operator="BooleanAnd" xmlns:ns2="System_CodeDom">
<ns2:CodeBinaryOperatorExpression.Left>
<ns2:CodeBinaryOperatorExpression Operator="BooleanAnd">
<ns2:CodeBinaryOperatorExpression.Left>
<ns2:CodePropertyReferenceExpression PropertyName="IsGreen">
<ns2:CodePropertyReferenceExpression.TargetObject>
<ns2:CodePropertyReferenceExpression PropertyName="Color">
<ns2:CodePropertyReferenceExpression.TargetObject>
<ns2:CodeThisReferenceExpression>
</ns2:CodeThisReferenceExpression>
</ns2:CodePropertyReferenceExpression.TargetObject>
</ns2:CodePropertyReferenceExpression>
</ns2:CodePropertyReferenceExpression.TargetObject>
</ns2:CodePropertyReferenceExpression>
</ns2:CodeBinaryOperatorExpression.Left>
<ns2:CodeBinaryOperatorExpression.Right>
<ns2:CodePropertyReferenceExpression PropertyName="IsRound">
<ns2:CodePropertyReferenceExpression.TargetObject>
<ns2:CodePropertyReferenceExpression PropertyName="Shape">
<ns2:CodePropertyReferenceExpression.TargetObject>
<ns2:CodeThisReferenceExpression>
</ns2:CodeThisReferenceExpression>
</ns2:CodePropertyReferenceExpression.TargetObject>
</ns2:CodePropertyReferenceExpression>
</ns2:CodePropertyReferenceExpression.TargetObject>
</ns2:CodePropertyReferenceExpression>
</ns2:CodeBinaryOperatorExpression.Right>
</ns2:CodeBinaryOperatorExpression>
</ns2:CodeBinaryOperatorExpression.Left>
<ns2:CodeBinaryOperatorExpression.Right>
<ns2:CodePropertyReferenceExpression PropertyName="Is3DObject">
<ns2:CodePropertyReferenceExpression.TargetObject>
<ns2:CodeThisReferenceExpression>
</ns2:CodeThisReferenceExpression>
</ns2:CodePropertyReferenceExpression.TargetObject>
</ns2:CodePropertyReferenceExpression>
</ns2:CodeBinaryOperatorExpression.Right>
</ns2:CodeBinaryOperatorExpression>
</ns0:RuleExpressionCondition.Expression>
</ns0:RuleExpressionCondition>
</ns0:Rule.Condition>

JurgenWillis at 2007-9-9 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified