BizTalk Server General - Another Rule Question

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > September 2005 > Another Rule Question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Another Rule Question
Matthew Berkland

2005-09-12, 6:07 pm

Hey Again,

This time I really need some help. I'm frustrated and just can't figure out
why this is happening. I am working with the rules engine to create our
purchasing ruleset. I am passing in 2 documents, 1 is the purchase order and
the other is a ruleresult document I came up with. As differnt rules are
fired I want to set flags in this document structure so when both documents
come back into the orchestration I can then route accordingly.

Here is my issue. I have created the following 3 rules:

Approval Needed:
IF
POTotal is greater than 20000
THEN
RuleResult.NeedsApproval = true

Check Items
IF
NOT
IsValidItem(POItems)
THEN
RuleResult.InvalidItems = true
Update(RuleResult)

Invalid Items
IF
RuleResult.InvalidItems
THEN
PO.FinalDisposition = Destroy

This is what is driving me nuts! I am testing the rules in the BRC and the
first go around I get a Match on all 3 rules. Therefore when the 2 rules
that will actually fire 'fire' and my update fact is executed the rule
engine never makes another pass to see that the RuleResult.InvalidItems is
now true which I want to have it fire the Invalid Items rule. It just starts
retracting all the facts and never makes a second pass. I am lost as to how
to structure my predicate on Invalid Items so it is not matched on the first
go around. Please someone help me, I've been tooling with this all morning
and am just stuck. I even tried the microsoft example for chainging:

Rule1
IF
ItemA.ID == 1
THEN
ItemB.ID = 2
Update(ItemB)

Rule2
IF
ItemB.ID == 2
THEN
ItemB.Value = 100

And this didn't work either..... I am obviously doing something wrong but I
dont' know what.

Here is the trace from the BRC perhaps it will help you all see what I am
trying to accomplish

----------------
RULE ENGINE TRACE for RULESET: Purchasing 9/12/2005 10:37:44 AM

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type: BusinessRuleHelpers.ValidItem
Object Instance Identifier: 18495050

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type: TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder
Object Instance Identifier: 51718129

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type: TypedXmlDocument:PurchaseOrderCreation.RuleResults
Object Instance Identifier: 54443429

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/*[local-name()='Purc
haseOrder' and
namespace-uri()='http://PurchaseOrderCreation.AAPurchaseOrder']/*[local-name
()='POHeader' and namespace-uri()='']
Object Instance Identifier: 20228817

CONDITION EVALUATION TEST (MATCH) 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Test Expression:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/*[local-name()='Purc
haseOrder' and
namespace-uri()='http://PurchaseOrderCreation.AAPurchaseOrder']/*[local-name
()='POHeader' and namespace-uri()=''].POTotal > 20000
Left Operand Value: 10
Right Operand Value: 20000
Test Result: False

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/PurchaseOrder/POHead
er/BRE_Routing
Object Instance Identifier: 47841633

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/*[local-name()='Purc
haseOrder' and
namespace-uri()='http://PurchaseOrderCreation.AAPurchaseOrder']/*[local-name
()='PODetail' and namespace-uri()='']/*[local-name()='Lines' and
namespace-uri()='']/*[local-name()='Line' and namespace-uri()='']
Object Instance Identifier: 27921517

CONDITION EVALUATION TEST (MATCH) 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Test Expression: NOT(True == BusinessRuleHelpers.ValidItem.IsValidItem)
Left Operand Value: True
Right Operand Value: False
Test Result: True

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type: TypedXmlDocument:PurchaseOrderCreation.RuleResults:/
Object Instance Identifier: 49967061

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Assert
Object Type:
TypedXmlDocument:PurchaseOrderCreation.RuleResults:/*[local-name()='RuleResu
lts' and namespace-uri()='http://PurchaseOrderCreation.RuleResults']
Object Instance Identifier: 47050372

AGENDA UPDATE 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Add
Rule Name: Check Items
Conflict Resolution Criteria: 0

CONDITION EVALUATION TEST (MATCH) 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Test Expression:
TypedXmlDocument:PurchaseOrderCreation.RuleResults:/*[local-name()='RuleResu
lts' and
namespace-uri()='http://PurchaseOrderCreation.RuleResults'].InvalidItems ==
True
Left Operand Value: False
Right Operand Value: True
Test Result: False

RULE FIRED 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Rule Name: Check Items
Conflict Resolution Criteria: 0

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Update
Object Type: TypedXmlDocument:PurchaseOrderCreation.RuleResults:/
Object Instance Identifier: 49967061

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type: TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder
Object Instance Identifier: 51718129

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type: TypedXmlDocument:PurchaseOrderCreation.RuleResults
Object Instance Identifier: 54443429

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/*[local-name()='Purc
haseOrder' and
namespace-uri()='http://PurchaseOrderCreation.AAPurchaseOrder']/*[local-name
()='PODetail' and namespace-uri()='']/*[local-name()='Lines' and
namespace-uri()='']/*[local-name()='Line' and namespace-uri()='']
Object Instance Identifier: 27921517

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/*[local-name()='Purc
haseOrder' and
namespace-uri()='http://PurchaseOrderCreation.AAPurchaseOrder']/*[local-name
()='POHeader' and namespace-uri()='']
Object Instance Identifier: 20228817

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type:
TypedXmlDocument:PurchaseOrderCreation.AAPurchaseOrder:/PurchaseOrder/POHead
er/BRE_Routing
Object Instance Identifier: 47841633

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type: TypedXmlDocument:PurchaseOrderCreation.RuleResults:/
Object Instance Identifier: 49967061

FACT ACTIVITY 9/12/2005 10:37:44 AM
Rule Engine Instance Identifier: 8a242d37-1f99-417d-8d43-054890bd9df0
Ruleset Name: Purchasing
Operation: Retract
Object Type:
TypedXmlDocument:PurchaseOrderCreation.RuleResults:/*[local-name()='RuleResu
lts' and namespace-uri()='http://PurchaseOrderCreation.RuleResults']
Object Instance Identifier: 47050372



----------------------------------------------------------------------------
----



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com