<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3199" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=691085410-20032009><FONT face=Arial
color=#0000ff size=2>Thanks very much</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Wolfgang
Laun<BR><B>Sent:</B> 20 March 2009 10:45<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> Re: [rules-users] Logic in the when
clause<BR></FONT><BR></DIV>
<DIV></DIV>Well, accesses to embedded objects are a little more complicated, but
if you want it:<BR><BR>rule HomeWinEt<BR>
when<BR> $f : Fact( $d : details
)<BR> eval(
$d.CLOCK_STAGE > 10 &&<BR>
($d.HOME_MATCH_SCORE - $d.HOME_FULL_TIME_SCORE ><BR>
$d.AWAY_MATCH_SCORE - $d.AWAY_FULL_TIME_SCORE))<BR>
then<BR> # ...<BR>end<BR><BR>Consider asserting the objects
stored as the Facts.details as well. This will let you write the much more
declarative (and presumably more efficient) rule with the "return value"
restriction:<BR><BR>rule HomeWinEtxxx<BR>
when<BR> $d : Detail( CLOCK_STAGE >
10,<BR>
HOME_MATCH_SCORE > (HOME_FULL_TIME_SCORE + AWAY_MATCH_SCORE -
AWAY_FULL_TIME_SCORE))<BR> $f : Fact(
details == $d )<BR>
then<BR> #
...<BR>end<BR><BR>-W<BR><BR><BR><BR><BR>
<DIV class=gmail_quote>2009/3/20 Zevenbergen, Alex <SPAN dir=ltr><<A
href="mailto:azevenbergen@paddypower.com">azevenbergen@paddypower.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>this is
the rule:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT color=#0000ff>
<P><FONT face=Arial color=#ff0000 size=2>rule "Home win et" </FONT></P>
<P><FONT face=Arial color=#ff0000 size=2>when</FONT></P>
<P><FONT face=Arial color=#ff0000 size=2>$f : Fact(details.CLOCK_STAGE >
10,<SPAN>(</SPAN>details.HOME_MATCH_SCORE -
details.HOME_FULL_TIME_SCORE<SPAN>)</SPAN>
> <SPAN>(</SPAN>details.AWAY_MATCH_SCORE -
details.AWAY_FULL_TIME_SCORE<SPAN>)</SPAN>)</FONT></P>
<P><FONT face=Arial color=#ff0000 size=2>then</FONT></P>
<P></P>
<P><FONT face=Arial color=#ff0000 size=2></FONT></P><FONT face=Arial
color=#ff0000 size=2>end</FONT></FONT></SPAN></DIV><BR>
<DIV lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
href="mailto:rules-users-bounces@lists.jboss.org"
target=_blank>rules-users-bounces@lists.jboss.org</A> [mailto:<A
href="mailto:rules-users-bounces@lists.jboss.org"
target=_blank>rules-users-bounces@lists.jboss.org</A>] <B>On Behalf Of
</B>Wolfgang Laun<BR><B>Sent:</B> 20 March 2009 09:15<BR><B>To:</B> Rules
Users List<BR><B>Subject:</B> Re: [rules-users] Logic in the when
clause<BR></FONT><BR></DIV>
<DIV>
<DIV></DIV>
<DIV class=h5>
<DIV></DIV>You could use eval( <expression> ) for this, but I guess it
could also be added as a return value field constraint to the last of these
four fields. Would you mind providing the full pattern?<BR>-W<BR><BR>
<DIV class=gmail_quote>2009/3/20 Zevenbergen, Alex <SPAN dir=ltr><<A
href="mailto:azevenbergen@paddypower.com"
target=_blank>azevenbergen@paddypower.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV><FONT face=Arial size=2><SPAN>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN>quick newbie question about the when
clause in a rule. eg can i get the fact to be tested from the result of two
other inputted facts?</SPAN></FONT></DIV>
<DIV><FONT size=+0><SPAN><FONT face=Arial color=#ff0000
size=2></FONT></SPAN></FONT> </DIV>
<DIV><FONT size=+0><SPAN><FONT face=Arial color=#ff0000
size=2>details.HOME_MATCH_SCORE - details.HOME_FULL_TIME_SCORE >
details.AWAY_MATCH_SCORE -
details.AWAY_FULL_TIME_SCORE</FONT></SPAN></FONT></DIV>
<DIV>
<P><SPAN><FONT face=Arial size=2>I assumed this would work fine but it
doesn't recognise the '-' as a minus!</FONT></SPAN></P>
<P><SPAN><FONT face=Arial size=2>Thanks in advance</FONT></SPAN></P>
<P><SPAN><FONT face=Arial size=2>Alex</FONT></SPAN></P></DIV>
<DIV><FONT face=Arial
size=2></FONT> </DIV><BR>________________________________________________________________________<BR>Privileged,
confidential and/or copyright information may be contained in this
communication. This e-mail and any files transmitted with it are
confidential and intended solely for the use of the individual or entity to
whom they are addressed. If you are not the intended addressee, you may not
copy, forward, disclose or otherwise use this e-mail or any part of it in
any way whatsoever. To do so is prohibited and may be unlawful. If you have
received this email in error <BR>please notify the sender
immediately.<BR><BR>Paddy Power PLC may monitor the content of e-mail sent
and received for the purpose of ensuring compliance with its policies and
procedures.<BR><BR>Paddy Power plc, Airton House, Airton Road, Tallaght,
Dublin 24 Registered in Ireland:
16956<BR>________________________________________________________________________<BR></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><BR><BR>________________________________________________________________________<BR>Privileged,
confidential and/or copyright information may be contained in this
communication. This e-mail and any files transmitted with it are confidential
and intended solely for the use of the individual or entity to whom they are
addressed. If you are not the intended addressee, you may not copy, forward,
disclose or otherwise use this e-mail or any part of it in any way whatsoever.
To do so is prohibited and may be unlawful. If you have received this email in
error <BR>please notify the sender immediately.<BR><BR>Paddy Power PLC may
monitor the content of e-mail sent and received for the purpose of ensuring
compliance with its policies and procedures.<BR><BR>Paddy Power plc, Airton
House, Airton Road, Tallaght, Dublin 24 Registered in Ireland:
16956<BR>________________________________________________________________________<BR></DIV></DIV></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>
________________________________________________________________________<BR>
Privileged, confidential and/or copyright information may be contained in this communication. This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, you may not copy, forward, disclose or otherwise use this e-mail or any part of it in any way whatsoever. To do so is prohibited and may be unlawful. If you have received this email in error <BR>
please notify the sender immediately.<BR>
<BR>
Paddy Power PLC may monitor the content of e-mail sent and received for the purpose of ensuring compliance with its policies and procedures.<BR>
<BR>
Paddy Power plc, Airton House, Airton Road, Tallaght, Dublin 24 Registered in Ireland: 16956<BR>
________________________________________________________________________<BR>
</BODY></HTML>