<html><body bgcolor="#FFFFFF"><div>Using globals in rule conditions is generally a bad idea. This is because changes to the globals are not tracked automatically so rule firing is 1) not responsive to data changes, and 2) somewhat random when change happens. Basically, avoid it.<br><br>GreG</div><div><br>On Jan 13, 2011, at 15:56, Gregory Mace <<a href="mailto:gregorymace@earthlink.net">gregorymace@earthlink.net</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">Here is a simple example where 'otherPersonList' is a global java.util.List:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">RuleTable Are friends having fun</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">CONDITION<span class="Apple-tab-span" style="white-space:pre">                                                </span>CONDITION<span class="Apple-tab-span" style="white-space:pre">                                        </span>ACTION</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">
</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">person: Person, op: Person from otherPersonList<span class="Apple-tab-span" style="white-space:pre">        </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">p</span>erson.getRelationShip(op)<span class="Apple-tab-span" style="white-space:pre">                                </span>op.getActivity()<span class="Apple-tab-span" style="white-space:pre">                                </span>System.out.println("$param");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">FRIEND<span class="Apple-tab-span" style="white-space:pre">                                                        </span>PLAYING<span class="Apple-tab-span" style="white-space:pre">                                                </span>Your friend is having fun</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">ENEMY<span class="Apple-tab-span" style="white-space:pre">                                                        </span>WORKING<span class="Apple-tab-span" style="white-space:pre">                                                </span>Not your friend and not having fun</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">which produces the following drl output:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">#From row number: 31</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">rule "Friends are having fun_31"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>when</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>person: Person, op : Person from otherPersonList(person.getRelationShip(op) == "FRIEND", op.getActivity() == "PLAYING")</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>then</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println("Your friend is having fun ");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">end</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; min-height: 15px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">#From row number: 32</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">rule "Friends are having fun_32"</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>when</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>person: Person, op : Person from otherPersonList(person.getRelationShip(op) == "ENEMY", op.getActivity() == "WORKING")</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>then</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println("Not your friend and not having fun");</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">end</div></div><div><br></div><div>shouldn't the 'from' be after the statement like this:?</div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; "><br></span></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">person: Person, op : Person(person.getRelationShip(op) == "ENEMY", op.getActivity() == "WORKING") </span><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">from otherPersonList</span></div><div><font class="Apple-style-span" face="Monaco" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br></span></font></div><div><span class="Apple-style-span" style="font-family: Monaco; font-size: 11px; ">Thx</span></div><div><br></div><div><div>On Jan 13, 2011, at 11:47 AM, Wolfgang Laun wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">I think I understand your question, but I'm not sure how to answer it. ;-)<br><br>What, exactly, are you trying to do? "Pulling" from a list means what?<br><br>-W <br><br><br><div class="gmail_quote">On 13 January 2011 20:34, Gregory Mace <span dir="ltr"><<a href="mailto:gregorymace@earthlink.net"><a href="mailto:gregorymace@earthlink.net">gregorymace@earthlink.net</a></a>></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;">I believe I have the list set up correctly as a variable, but I am not sure how to set up a condition that pulls from a global list. Any examples?<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></a><br>
</blockquote></div><br>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org"><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rules-users mailing list</span><br><span><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span><br></div></blockquote></body></html>