Re: [rules-users] Looping through a vector object in a rule

2011-05-05 Thread Michael Anstis
Hi, You have to "let go" of the need to explicitly iterate collections within rules. You wouldn't normally think about iterating all records yourself in a database when performing a SQL statement like this:- select sum(ch.claimAmount) as total from claim c, claimHistory ch where c.claimId = ch.f

Re: [rules-users] Looping through a vector object in a rule

2011-05-05 Thread sdinoo
Hi Michael Thank you for helping me out - but I need some more help Pardon my ignorance, but I am still not clear how this can be done I am looking for something in the language that will allow me to iterate through the entire List/Vector object by object and then access each object instances va

Re: [rules-users] Looping through a vector object in a rule

2011-05-04 Thread Michael Anstis
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 ) $

Re: [rules-users] Looping through a vector object in a rule

2011-05-04 Thread Michael Anstis
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 = getClaimHisto

[rules-users] Looping through a vector object in a rule

2011-05-04 Thread sdinoo
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("c