我正在尝试编写一个规则,将事实列表值与多条件规则进行比较
rule: only valid legislations
when
fact:Fact (legislationList == ('L1' && 'L2') OR 'L3')
then
fact.printMessage();
end
ie. if fact.legislationList={'L1', 'L2') then fire
if fact.legislationList={'L1', 'L4') then dont fire
我查看了“from”子句,但不清楚这将如何解决我的问题。
有一些巫术方法/解决方案可以帮助我吗?
谢谢
-lp
最佳答案
假设立法列表是一个列表
rule: only valid legislations
when
fact:Fact ((legislationList contains "L1" && legislationList contains "L2") || legislationList contains "L3" )
then
fact.printMessage();
end
您可以稍微缩写语法,但我想明确一点。
希望对你有帮助
关于具有列表值和多个条件的事实规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31155181/