<div dir="ltr"><br> Hi Thomas and all,<br><br> 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>
The good news is that we work very close with MVEL'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> 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["a"] = "p"<br>OUT: p<br>mvel$ v="b"<br>OUT: b<br>mvel$ x[v]="q"<br>org.mvel.PropertyAccessException: unable to resolve property: failed to access property: <<v>> in: class java.util.HashMap<br>
ERROR: unable to resolve token: v<br>mvel$ w=10<br>OUT: 10<br>mvel$ x[w]="r"<br>org.mvel.PropertyAccessException: unable to resolve property: failed to access property: <<w>> in: class java.util.HashMap<br>
mvel$ x[10]="r"<br>OUT: r<br>mvel$ x<br>OUT: {a=p, 10=r}<br>mvel$ <br><br> []s<br> Edson<br><br><br><div class="gmail_quote">2008/7/24 thomas kukofka <span dir="ltr"><<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>></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've still Problems if I try to use <br>io: InputObject ( stringParameters[InputObject.<div dir="ltr">
Parameter.ParameterName] == "something") <br><br>=>Field/method 'InputObject' not found for class 'com.rules.InputObject'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 <<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>>:<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> 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">
return stringParameter;<br> }</div><br> <br>io: InputObject ( stringParameters["propertyname"] == "something") <br><br> []s<br> Edson<br><br><div class="gmail_quote">2008/7/23 thomas kukofka <<a href="mailto:thomaskukofka@web.de" target="_blank">thomaskukofka@web.de</a>>:<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'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>