[rules-users] Using an array column header in Drools Template

sk soumya.kr at gmail.com
Wed Nov 10 10:47:44 EST 2010


I am given a list of strings (Comma separated) as input and I need to check
if any of the strings satisfy a given condition. I am trying to implement it
using Drools Rule template with an array column header of unknown size.

To be more specific I need to be be able to generalize the below Template to
include any number of names in the eval statement.
The idea is to give any number of names as input and check if any of the
names satisy the condition given in the template.

template header
name[]

package gms.drools.templates;
global java.util.Map nameMap;

import java.util.Map;

template "RuleTemplate_name"

rule "rule_name"
	when 	
		//Generalize the below line to check if the nameMap contains any of the
names given in the input		//eval(nameMap.containsKey("@{name1}") ||
nameMap.containsKey("@{name2}") || nameMap.containsKey("@{name3}") ||
nameMap.containsKey("@{name4}"))
		
	then  
                System.out.println("SUCCESS");
end
end template

Please let me know if anyone has a solution for this or any other
suggestions.

-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Using-an-array-column-header-in-Drools-Template-tp1876743p1876743.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list