I assumed claimHistory is not related to Claim in your example, if it is however you can also do this:-
when
$c : Claim( $a : aField )
$ch : ClaimHistory( aField == $a ) from $c.claimHistory
then
...
end
Or, assuming bidirectional references:-
when
$c : Claim( $a : aField )
$ch : ClaimHistory( claim == $c, aField == $a )
then
...
end
You'd be better off inserting the individual claim history objects:-
when
$c : Claim( $a : aField )
$ch : ClaimHistory( aField == $a )
then
...
end
IIRC you can achieve the same by inserting the Vector by providing another rule to expand it first:-
Vector<ClaimHistory> claimHistory = getClaimHistory();
ksession.insert( claimHistory );
salience <A value hIgher than your other rules>
when
$v : Vector( )
$ch : ClaimHistory( ) from $v
then
insert( $ch );
end
You can also achieve the latter example using a global.
With kind regards,
MikeOn 4 May 2011 09:17, sdinoo <sdinoo@gmail.com> wrote:
I am new to drools
I am inserting into a ksession a single claim POJO + vector of previous
claims
Like this
ksession.insert(claim); // single claim
ksession.insert(historyClaims); // vector of claims
ksession.startProcess("com.dur.claim");
ksession.fireAllRules();
I want to compare single claim variable values with all the claims in the
vector
how do I loop through the vector objects and compare the values in the Rule
(.drl) file?
Can someone help me out?
--
View this message in context: http://drools.46999.n3.nabble.com/Looping-through-a-vector-object-in-a-rule-tp2897872p2897872.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users