Reputation: 956
I have the following rule in drool
rule klFor2001 salience 30
when
exists( Vgdokfag( Fagkode() == "FOR2001", ( Merknadkode() != "FAM13" ||
Merknadparameter() in ("FO1010", "FO1030", "FO1040"))))
vgs: HashSet() from collect(Vgdokfag( Fagkode() contains "UPF",
(Merknadkode() == "FAM13" ||
Merknadparameter() in ("FO1010","FO1030", "FO1040"))) )
then
insert(getKlIdr20xx("KL_IDR2001",true));
end
So what I am trying to do is to
I do not know how to do the second one. I am trying to get all facts with the given conditions and then some how check if the size of the set is bigger than 2, but for some reason I cannot write something like this
eval(vgs.size() > 2)
I am sure that I am doing something wrong here, can someone please help me.
cheers,
es
Upvotes: 0
Views: 380
Reputation: 6322
You were really close. You can add the size
constraint straight into the HashSet
:
vgs: HashSet(size >= 2) from collect(...)
Upvotes: 3