[rules-users] Looping through a vector object in a rule
Michael Anstis
michael.anstis at gmail.com
Wed May 4 05:27:30 EDT 2011
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,
Mike
On 4 May 2011 09:17, sdinoo <sdinoo at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110504/6345c12b/attachment.html
More information about the rules-users
mailing list