This is all very well, but why does it have to be so complicated?<br><br>rule createFacts<br>when<br>then<br>   for( String s: new String[]{ &quot;one&quot;, &quot;two&quot;, &quot;three&quot; } ){<br>      insert( new Fact( s ) );<br>
   }<br>end<br><br>This rule executes once. Presumably you&#39;ll use a very high salience. The condition might contain CEs to make this happen depending on whatever.<br><br>It&#39;s doable from a spreadsheet, using the &quot;forall&quot; substitution.<br>
<br>-W<br><br><br><div class="gmail_quote">On 9 March 2011 09:41, FrankVhh <span dir="ltr">&lt;<a href="mailto:frank.vanhoenshoven@agserv.eu">frank.vanhoenshoven@agserv.eu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
The way I understand your question, you want to evaluate some string value<br>
to a list of Strings, and insert an &quot;alarm&quot; in the form of a new object to<br>
notify that these values are present.<br>
<br>
This is possible. Insert a String into working memory, then call the<br>
following rule:<br>
<br>
#Testing rule<br>
rule &quot;test&quot;<br>
        when<br>
                $vals: String(this in (&quot;help&quot;,&quot;support&quot;,&quot;assist&quot;))<br>
                not Fact(value == $vals )<br>
        then<br>
                insert ( new Fact ( $vals ) );<br>
                System.out.println(&quot;This WORKS!&quot;);<br>
end<br>
<br>
The rule checks for a String in working memory, and evaluates its contents (<br>
this in ( list ) ) . If a Fact with the corresponding value hasn&quot;t been<br>
inserted yet, it will be inserted at runtime.<br>
<br>
Regards,<br>
Frank<br>
<br>
<br>
groovenarula wrote:<br>
&gt;<br>
&gt; Hello all,<br>
&gt;<br>
&gt; In one of my use cases, I need to insert a variable collections of facts<br>
&gt; into working memory in order to be able to test for those values later :<br>
&gt;<br>
&gt; So I was wondering if there&#39;s a way to do something like this<br>
&gt;<br>
&gt;     when<br>
&gt;         $vals : String() from [ &quot;A 12345&quot;, &quot;B 45678&quot;, &quot;C 8695&quot; ]<br>
&gt;     then<br>
&gt;          insert ( new Fact ( $vals ) );<br>
&gt;<br>
&gt; With the intention that the rule will fire 3 times and insert the 3 new<br>
&gt; facts with the values &quot; A 12345&quot; and &quot;B 45678&quot; and &quot;C 8695&quot;.<br>
&gt;<br>
&gt; Is this possible using rules or do I have to resort to using functions.<br>
&gt; The problem I&#39;m trying to overcome is to see if there&#39;s a way to get the<br>
&gt; &quot;A 12345&quot;, &quot;B 45678&quot;, &quot;C 8695&quot;  from a single cell of a spreadsheet.<br>
&gt;<br>
&gt; Thanks in advance,<br>
&gt; G<br>
&gt;<br>
<font color="#888888"><br>
<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-tp2654135p2654347.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Is-it-possible-to-Iteriate-over-a-list-of-string-values-tp2654135p2654347.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>