[rules-users] Getting Exception while using Array in rules template

Manikandan Subramanian vsmani.chrome at gmail.com
Wed Apr 11 22:40:53 EDT 2012


I am getting exception when using Array in combination with "in (...)".
Below is the exception
[Error: unable to resolve method: java.util.HashMap.countyName()
[arglength=0]]

and below is the template I have created

template header
stateName
countyName[]
totalPremium

package org.drools.bpmn2

template "Premium"
stateName
totalPremium

rule "Premium_@{row.rowNumber}"
ruleflow-group "insurance premium"

  when

      Input(stateName == @{stateName}, countyName in (@{countyName}))

  then
      System.out.println("total premium " + @{totalPremium});
end
end template

the excel sheet is having the data, the column corresponds to countyName as
CSV value with variable number of variables either empty or 1 or 2 and so
on.

If I give the when like below it works (with countyName0 instead of
countyName).

  when

      Input(stateName == @{stateName}, countyName in (@{countyName0}))

Do I need to use foreach to generate the countyName sequence like
countyName0, countyName1 .. etc to put it in the "in (...)" condition?

I didnt find much documention about templates that covers foreach with in.
Please help.  Any examples or samples would be helpful.
-- 
Thanks,
Mani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120412/14f0a256/attachment.html 


More information about the rules-users mailing list