<div dir="ltr"><br>&nbsp;&nbsp; Hi Thomas and all,<br><br>&nbsp;&nbsp; Drools delegates most of the complex expression evaluation to MVEL and it seems that it currently does not support variables as indexes in the map/collection simplified syntax. So, it will not work for now. <br>
&nbsp;&nbsp; The good news is that we work very close with MVEL&#39;s author and if we kindly ask him (translation: offer him a few drinks and/or gifts) :) he usually adds support to such things.. ;) if so, just upgrading MVEL dependency jar will be enough to make it work, no need for a new drools release (hopefully). I will talk to him.<br>
<br>&nbsp;&nbsp; Meanwhile, tip for the curious: MVEL has a shell tool quite useful to play and check such things. Just run org.mvel.MVELSH having the MVEL jar in your classpath and you can play with it:<br><br>Welcome to MVEL!<br>
mvel$ x = new java.util.HashMap()<br>OUT: {}<br>mvel$ x[&quot;a&quot;] = &quot;p&quot;<br>OUT: p<br>mvel$ v=&quot;b&quot;<br>OUT: b<br>mvel$ x[v]=&quot;q&quot;<br>org.mvel.PropertyAccessException: unable to resolve property: failed to access property: &lt;&lt;v&gt;&gt; in: class java.util.HashMap<br>
ERROR: unable to resolve token: v<br>mvel$ w=10<br>OUT: 10<br>mvel$ x[w]=&quot;r&quot;<br>org.mvel.PropertyAccessException: unable to resolve property: failed to access property: &lt;&lt;w&gt;&gt; in: class java.util.HashMap<br>
mvel$ x[10]=&quot;r&quot;<br>OUT: r<br>mvel$ x<br>OUT: {a=p, 10=r}<br>mvel$ <br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br><div class="gmail_quote">2008/7/24 thomas kukofka <span dir="ltr">&lt;<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br>Thanks,<br><br>but I&#39;ve still Problems if I try to use <br>io: InputObject ( stringParameters[InputObject.<div dir="ltr">
Parameter.ParameterName] == &quot;something&quot;) <br><br>=&gt;Field/method &#39;InputObject&#39; not found for class &#39;com.rules.InputObject&#39;Rule Compilation error<br>

<br>Parameter is an enum witch contains all allowed Parameters of InputObject<br><br>Kind Regards<br>Thomas</div><br><div class="gmail_quote">2008/7/23 Edson Tirelli &lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>&gt;:<div class="Ih2E3d">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div dir="ltr"><br><br>&nbsp;&nbsp; If you make your map available through a get, you can use simplified Map syntax like this:<br>

<br>public Map getStringParameters() {<br><div dir="ltr">
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return stringParameter;<br>&nbsp;&nbsp;&nbsp; }</div><br>&nbsp;&nbsp;&nbsp; <br>io: InputObject ( stringParameters[&quot;propertyname&quot;] == &quot;something&quot;) <br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/7/23 thomas kukofka &lt;<a href="mailto:thomaskukofka@web.de" target="_blank">thomaskukofka@web.de</a>&gt;:<br>


<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div><div dir="ltr">Hello ,<br><br>I just recognized, that this doesn&#39;t work. But it is possible to use plain Java code in the rule, also if-conditions and for and while-loops etc.. However more Java code makes the rule less readable and elegant.<br>



Is there another possibility to use generic input objects?<br><br>Thomas<br><br><br></div>
<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a>
</font></div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>
<br></blockquote></div></div><br></div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>