That's right.. globals are usually used to access to external services and usually you don't want to do inferences over that global references. Global are not facts. If you want to do inferences create a fact :)<br>
<br>Cheers<br><br><div class="gmail_quote">On Mon, Jul 18, 2011 at 3:55 PM, Swindells, Thomas <span dir="ltr"><<a href="mailto:TSwindells@nds.com">TSwindells@nds.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Don't use a global, instead create a new fact type "Global" having a single field globalVariable (type object will probably do), then you can pretty much write what you have below (once you add the missing bracket).<br>
Alternatively you may be able to do something like eval(Arrays.asList("X", "Y").contains(globalVariable))<br>
<br>
Thomas<br>
<br>
> -----Original Message-----<br>
> From: <a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [mailto:<a href="mailto:rules-users-">rules-users-</a><br>
> <a href="mailto:bounces@lists.jboss.org">bounces@lists.jboss.org</a>] On Behalf Of pamerida<br>
> Sent: 18 July 2011 19:09<br>
> To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> Subject: [rules-users] Global variable in LHS<br>
<div><div></div><div class="h5">><br>
> Hi everybody,<br>
><br>
> I would like to analyze a global value in the LHS of my rule without using an<br>
> eval, something like this:<br>
><br>
><br>
> global String globalVariable;<br>
><br>
> rule 'SI-002-NAD-6'<br>
> salience 5000<br>
> when<br>
> global (globalVariable in ("X","Y")<br>
> then<br>
> logger.log("[SI-002-NAD-6] Debe colocar la información del<br>
> propietario del medio de transporte.");<br>
> end<br>
><br>
> I cant use eval because it doesnt recognize the keyword "in", for example<br>
> this code would throw me an error in the validation<br>
><br>
> global String globalVariable;<br>
><br>
> rule 'SI-002-NAD-6'<br>
> salience 5000<br>
> when<br>
> eval (globalVariable in ("X","Y")<br>
> then<br>
> logger.log("[SI-002-NAD-6] Debe colocar la información del<br>
> propietario del medio de transporte.");<br>
> end<br>
><br>
> any suggestions? thanks so much for your help :)<br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://drools.46999.n3.nabble.com/Global-" target="_blank">http://drools.46999.n3.nabble.com/Global-</a><br>
> variable-in-LHS-tp3180063p3180063.html<br>
> Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
><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>
<br>
</div></div>**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
<div><div></div><div class="h5"><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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> - CTO @ <a href="http://www.plugtree.com">http://www.plugtree.com</a> <br> - MyJourney @ <a href="http://salaboy.wordpress.com">http://salaboy.wordpress.com</a><br>
- Co-Founder @ <a href="http://www.jbug.com.ar">http://www.jbug.com.ar</a><br> <br> - Salatino "Salaboy" Mauricio -<br>