If the &quot;global&quot; is both modified by rules and investigated by rules: then it&#39;s not a global but a singleton fact.<br><br>You can use a global in a condition, but only if the data obtained from the global is constant over time.<br>
<br>I think that your &quot;container&quot; ought to be a fact.<br><br>-W<br> <br><br><div class="gmail_quote">2011/7/29 Matthew Erler <span dir="ltr">&lt;<a href="mailto:wires8@yahoo.com">wires8@yahoo.com</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;"><table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
I&#39;m using Drool 5.  I reviewed globals and it looks like it might be appropriate for my situation.  I find plenty of documentation on how to use a global in a consequence, but none on how to use a global in a condition.  Do you know if it&#39;s possible to use a global in a condition?  My situation is that I need to check a container class to see if the container is filled, if not then fill the container (the condition would actually be more elaborate and include facts but I&#39;m omitting them for the sake of brevity).  The DRL file would look something like this (the example doesn&#39;t work of course):<br>
<br><br>global com.example.Container globalContainer;<br><br>rule &quot;container full rule&quot;<br>  when<br>    globalContainer.getContentsFlag() == false<br>  then<br>    globalContainer.fill(new
 ContainerContents());<br>    globalContainer.setContentsFlag(true);<br><br><br>--- On <b>Fri, 7/29/11, Esteban Aliverti <i>&lt;<a href="mailto:esteban.aliverti@gmail.com" target="_blank">esteban.aliverti@gmail.com</a>&gt;</i></b> wrote:<br>
<blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Esteban Aliverti &lt;<a href="mailto:esteban.aliverti@gmail.com" target="_blank">esteban.aliverti@gmail.com</a>&gt;<br>
Subject: Re: [rules-users] How to add application data via StatefulKnowledgeSession<br>To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>&gt;<br>
Date: Friday, July 29, 2011, 3:51 AM<br><br><div>Which version of drools are you using? The document you pointed out seems a little bit old.<div>Since Drools 5, you can use globals to use application&#39;s data in your DRLs.</div>
<div>If you are using Drools 5 or higher, I suggest you to read the documentation about globals.</div>

<div><br></div><div>Best Regards, <br clear="all"><br>XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<br><br>Esteban Aliverti<br>- Developer @ <a rel="nofollow" href="http://www.plugtree.com" target="_blank">http://www.plugtree.com </a><br>
- Blog @ <a rel="nofollow" href="http://ilesteban.wordpress.com" target="_blank">http://ilesteban.wordpress.com</a><br>


<br><br><div>2011/7/28 Matthew Erler <span dir="ltr">&lt;<a rel="nofollow" href="http://mc/compose?to=wires8@yahoo.com" target="_blank">wires8@yahoo.com</a>&gt;</span><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit;" valign="top">
<div>Can someone please show me an example where application data is added to<br>workingMemory as described here:<br><a rel="nofollow" href="http://docs.codehaus.org/display/DROOLS/Application+Data" target="_blank">http://docs.codehaus.org/display/DROOLS/Application+Data</a> using<br>


StatefulKnowledgeSession?</div>
<div>I have a need to populate an object from a rules file and I don&#39;t want that<br>object itself to be treated as a rule.  All the examples I can find refer to<br>the use of ruleBase to get workingMemory.  My code utilizes<br>


StatefulKnowledgeSession to fire rules and I don&#39;t see how to get ruleBase<br>or workingMemory from it.  Thanks.</div></td></tr></tbody></table><br>_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" href="http://mc/compose?to=rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a rel="nofollow" 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></div>
</div><br>-----Inline Attachment Follows-----<br><br><div>_______________________________________________<br>rules-users mailing list<br><a href="http://mc/compose?to=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></div></blockquote></td></tr></tbody></table><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>