简体   繁体   English

制定规则时如何在drools-guvnor中比较相同事实的两个约束

[英]How to compare two constraints of same fact in the drools-guvnor while making a rule

I have Fact - Orders and two constraints under it : Orders - > Account and Orders - > TargetAccount 我有事实-订单和下面的两个约束:订单->帐户和订单-> TargetAccount

I am making a rule inside free form DRL such that if Orders.Account.AccountNumber ! 我正在自由格式DRL中制定规则,例如,如果Orders.Account.AccountNumber! = Orders.TargetAccount.AccountNumber then a specific PDF should be generated. = Orders.TargetAccount.AccountNumber,则应生成特定的PDF。

How to write this when condition ? 条件时该如何写?

Based on your description, it should be as simple as 根据您的描述,它应该像

when
  Orders.Account.AccountNumber ! = Orders.TargetAccount.AccountNumber
then
  // generate specific PDF

Or was the some details involved that I missed? 还是我错过了一些细节?

Ok - so it worked like this way : Orders (Account.AccountNumber != TargetAccount.AccountNumber) I recommend to use minimum of || 好的-这样工作:订单(Account.AccountNumber!= TargetAccount.AccountNumber)我建议使用||的最小值。 or && , instead use number of free form DRLs one below each other if OR conditions are not there . 或&&,如果OR条件不存在,则改用其他格式的自由格式DRL。 Try to avoid && , it creates issues specially when we have more than 2 AND conditions 尽量避免&&,当我们有两个以上AND条件时,它会特别产生问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM