<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi All,<div><br></div><div>I'm trying to determine if it's possible to process arrays of data using Rule Templates. &nbsp;An example of what I'm trying to accomplish.</div><div><br></div><div>Spreadsheet of rules, with one of the columns being valid colors. &nbsp;Valid colors contains comma separated data and is variable length.</div><div><br></div><div>For example</div><div><br></div><div>It might contain: "Blue, Green, Red" or "Blue", or "Red, Green, Purple, Silver" &nbsp;Any number of entries.</div><div><br></div><div>I then need to process incoming fact values against this list of colors, using either CONTAINS or IN.</div><div><br></div><div>For example:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">template header</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">desc</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">valid_colors[]</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">package org.drools.examples.templates</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">global com.sample.Product product;</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">template "ColorTestTemplate"</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">rule "ColorRule_@{row.rowNumber}"</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">when</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>product1 : Product (Color in @{valid_colors});</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">then</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>product1.setDesc("@{desc}");</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">end</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">end template</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">I know the following doesn't work:&nbsp;product1 : Product (Color in @{valid_colors});</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">However, I wanted to depict what I'm trying to accomplish.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">The challenge is with valid_colors being a variable length array, I can't refer to the individual values using constants i.e. valid_colors0, valid_colors1, valid_colors3, etc to build my array list.</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">ie Color in ("@{valid_colors0}", "@{valid_colors1}", "@{valid_colors2}")</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">Is there a way to iterate through a variable length array in a template?</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">Any thoughts on how I could build an array list i.e. ("Blue", "Green", "Red") when the column contains a variable length array?</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; "><br></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">Thanks in advance,</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; min-height: 15px; ">Jason</div></body></html>