The Expert documentation states "<a id="d0e4708">The expression used to define the object source is any expression
that follows regular MVEL syntax." T</a>herefore "from" should be able to use the MVEL syntax for arrays ["one", "two", "three"] however I've not tried and never seen it used. Normally people use "from" to iterate over a dynamic list created elsewhere (another Fact pattern, a global etc). Since you say you need to handle "variable collections" I'd have thought the latter use-case more suitable for yor needs. something like:-<br>
<br>when<br> $pch : ParsedCellHolder( )<br> $val : String( ) from $pch.getStrings( )<br>then<br> insert( new Fact( $val ) );<br>end<br><br>Of course one begs to ask why you don't simply insert the individual values into WM as the spreadsheet is parsed?<br>
<br>You'll be doing something like that to either construct the static MVEL in your example or a list.<br><br>With kind regards,<br><br>Mike<br><br><div class="gmail_quote">On 9 March 2011 06:19, groovenarula <span dir="ltr"><<a href="mailto:gnarula1@la-z-boy.com">gnarula1@la-z-boy.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hello all,<br>
<br>
In one of my use cases, I need to insert a variable collections of facts<br>
into working memory in order to be able to test for those values later :<br>
<br>
So I was wondering if there's a way to do something like this<br>
<br>
when<br>
$vals : String() from [ "A 12345", "B 45678", "C 8695" ]<br>
then<br>
insert ( new Fact ( $vals ) );<br>
<br>
With the intention that the rule will fire 3 times and insert the 3 new<br>
facts with the values " A 12345" and "B 45678" and "C 8695".<br>
<br>
Is this possible using rules or do I have to resort to using functions. The<br>
problem I'm trying to overcome is to see if there's a way to get the "A<br>
12345", "B 45678", "C 8695" from a single cell of a spreadsheet.<br>
<br>
Thanks in advance,<br>
G<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654135.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654135.html</a><br>
Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>