Another Rule Question
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > BizTalk Server > BizTalk Server General > Another Rule Question




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Another Rule Question  
Matthew Berkland


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-12-05 11: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()='Rule
Resu
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()='Rule
Resu
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()='Rule
Resu
lts' and namespace-uri()='http://PurchaseOrderCreation.RuleResults']
Object Instance Identifier: 47050372



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








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register