I am trying to do something like below to collect a ecrtain type of objects fullfilling certain conditions.
rule "collect_other"
$lineItem2 : A( $iVal : iValue, $qd2 : quantity)
B($bVal : bId)
$rowLowerOther : C(iValue == $iVal, bId == $bVal,
$lsequence : sequence, $jValue : jAvlDate)
$rowHigherOther : List()
from collect(C(iValue == $iVal, bId == $bVal,
sequence == $lsequence-1, jAvlDate != $jValue))
then
//do something
end
Right Now I am getting one object only even though I am having numbers of object fullfilliong the condition.
Note: I want to collect all items fullfilling conditions by taking the value from first object instance of "C"
Please help me.
Objects of class C are:
Let's assume that we have
Then the pattern
matches any of these C objects, binding $lsequence to 1, 2, 3 and so on. For the first binding, the rule doesn't fire, because no C fact matches sequence == 1-1
For each of the values 2, 3, 4 and so on, the rule will match and collect exactly on C fact into the list, i.e., the one with seuqnce == 1, 2, 3,... respectively.
Perhaps this does what you want - but I'm only guessing.