开发者

Biztalk rules, how to have a rule fire only if all other rules within same policy is not fired

I am building a validation policy, the rule sets will validate the xml document I passed in, raise different kind of validation errors if anything invalid is found. However, I want to buld one additional rule that says 'if no validation error is found, do something'. Is it possible to archieve this and how?

i.e. rule look开发者_JS百科s like this

if doc.firstname=dog then isDocumentValidate=false; failedReason='must be a human' if doc.age=0 then isDocumentValidate=false; failedReason='must be an adult' if isDocumentValidate=true then doSomething


Yes, you can set a priority on each rule within the policy (click on the rule and examine its properties). The rules will execute from the highest priority number to the lowest. You can also use negative numbers. After you "invalidate" a document, you can stop firing additional rules (example of this here).

However for your example, if possible I would suggest that you have the default value for isDocumentValidate=true, and the BRE will only need to worry about changing the value on invalid instances.

A rule with an condition of 1 is equal to 1 will always be true. Have that rule be your lowest priority.


You can accomplish this by creating a rule for your default condition, isDocumentValidate=true, set the condition to 1 equals 1, and set the priority higher than the rest of your rules. This way, the default rule will fire first, setting your default value, then if any other rules match, they will set the value appropriately.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜