<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,&nbsp;<div><br></div><div>Thanks for the response.&nbsp;</div><div><br></div><div>That doesn't seem to be right - this is what is produced from the Compiler.</div><div><br></div><div><div><font face="Monaco">// rule values at A9, header at A3</font></div><div><font face="Monaco">rule "Test rule_9"</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>when</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$c : ConditionObject(somefield)</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$a : ActionObject(this != null == "X")</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>EmbeddedObject(myField == AnEnum.SomeOtherValue) from $c.embedded</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">        </span>then</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>ActionObject.someMethod2(50);</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$a.someMethod("someOtherValue")</font></div><div><font face="Monaco"><span class="Apple-tab-span" style="white-space:pre">                </span>$a.someMethod3(B)</font></div><div><font face="Monaco">end</font></div><div><br></div><div>Is there a way to have a "when" rule produced where the data table row, for that CONDITION is empty ?&nbsp;</div><div>The hack version I can work out is</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div><div><div>CONDITION<br>$a : ActionObject<br></div>$param != null<br></div>this</div>this</div></blockquote></div><div><br></div><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div>Ramon Buckland</div><div><a href="mailto:ramon@thebuckland.com">ramon@thebuckland.com</a></div><div><br></div></span><br class="Apple-interchange-newline">

</div>
<br><div><div>On 22 May 2013, at 10:33, Michael Anstis &lt;<a href="mailto:michael.anstis@gmail.com">michael.anstis@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div><div><div><div>Add an additional CONDITION for ActionObject.<br><br>You'll need to probably add a constraint for "this != null" and put an X in the rows; e.g.<br><br></div>CONDITION<br>$a : ActionObject<br>
</div>this != null<br></div>X<br></div>X<br><br><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 22 May 2013 09:55, Ramon Buckland <span dir="ltr">&lt;<a href="mailto:ramon@thebuckland.com" target="_blank">ramon@thebuckland.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi.&nbsp;<div><br></div><div>I am working on Drools 5.5.0.Final and have a question regarding XLS and a Decision Table structure,</div>
<div><br></div><div>I have a ConditionObject and an ActionObject and wanted to know or see an example for XLS that produces a "does exist" for the ActionObject</div><div>in the when.</div><div><br></div><div>I can simply write the rule in a DRL, but translating how to make the XLS compiler create the same is proving challenging.</div>
<div><br></div><div>An example:</div><div><br></div><div>I want to produce a set of rules like below</div><div><br></div><div><font face="Monaco">rule "Test rule_11"</font></div><div><font face="Monaco">when</font></div>
<div><font face="Monaco">&nbsp; &nbsp; $c : ConditionObject( somefield )</font></div><div><font face="Monaco">&nbsp; &nbsp;&nbsp;EmbeddedObject(myField == AnEnum.SomeValue) from $c.embedded</font></div><div><font face="Monaco">&nbsp; &nbsp; $a : ActionObject( )</font></div>
<div><font face="Monaco">then&nbsp;</font></div><div><font face="Monaco">&nbsp; &nbsp; $a.someMethod("value")</font></div><div><font face="Monaco">&nbsp; &nbsp; $a.someMethod2(10)</font></div><div><font face="Monaco">&nbsp; &nbsp; $a.someMethod3("A")</font></div>
<div><font face="Monaco">end</font></div><div><br></div><div><font face="Monaco">rule "Test rule_12"</font></div><div><font face="Monaco">// some other AnEnum checks.</font></div><div><br></div><div>What I can't work out is how I get the test of "existence" of the Action Object into the "when" for the rule, so that I can "use" the Object in the ACTION.</div>
<div>In addition, is there a away that I can avoid needing a whole column just for "existence of an object with a field.. collect as a variable $c : (ConditionObject( somefield )" ?</div><div><br></div><div>CONDITION<span style="white-space:pre-wrap">                        </span>CONDITION<span style="white-space:pre-wrap">                                                </span>ACTION<span style="white-space:pre-wrap">                                        </span>ACTION<span style="white-space:pre-wrap">                                </span>ACTION</div>
<div>$c : ConditionObject<span style="white-space:pre-wrap">                </span>EmbeddedObject() from $c.embedded<span style="white-space:pre-wrap">        </span></div><div>$param<span style="white-space:pre-wrap">                                </span>myField == AnEnum.$param<span style="white-space:pre-wrap">                        </span>$a.someMethod("$param")<span style="white-space:pre-wrap">        </span>$a.someMethod2($param)<span style="white-space:pre-wrap">        </span>$a.someMethod3($param)</div>
<div>"Description"<span style="white-space:pre-wrap">                        </span>"Description"<span style="white-space:pre-wrap">                                                </span>"Description"<span style="white-space:pre-wrap">                                </span>"Description"<span style="white-space:pre-wrap">                        </span>"Description"</div>
<div>somefield<span style="white-space:pre-wrap">                                </span>SomeValue<span style="white-space:pre-wrap">                                                </span>value<span style="white-space:pre-wrap">                                        </span>10<span style="white-space:pre-wrap">                                        </span>A<span style="white-space:pre-wrap">        </span></div>
<div>somefield<span style="white-space:pre-wrap">                                </span>SomeOtherValue<span style="white-space:pre-wrap">                                        </span>someOtherValue<span style="white-space:pre-wrap">                        </span>50<span style="white-space:pre-wrap">                                        </span>B</div>
<div><br></div><div>This is the XLS of the above.</div><div><br></div><div><a href="https://www.dropbox.com/s/lw3zb5hwtjdbpcm/sample_rules.xls?v=1scns" target="_blank">https://www.dropbox.com/s/lw3zb5hwtjdbpcm/sample_rules.xls?v=1scns</a></div>
<div><br></div><div>When this sheet is compiled, I get the following: How do I setup a "condition" for ActionObject to get in the when ?</div><div><br></div><div><div><div><font face="Monaco">package packageName;</font></div>
<div><font face="Monaco">//generated from Decision Table</font></div><div><font face="Monaco">// rule values at A8, header at A3</font></div><div><font face="Monaco">rule "Test rule_8"</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>when</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$c : ConditionObject(somefield)</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">                </span>EmbeddedObject(myField == AnEnum.SomeValue) from $c.embedded</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">        </span>then</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod("value")</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod2(10)</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod3(A)</font></div><div><font face="Monaco">end</font></div><div><font face="Monaco"><br></font></div><div><font face="Monaco">// rule values at A9, header at A3</font></div>
<div><font face="Monaco">rule "Test rule_9"</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>when</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$c : ConditionObject(somefield)</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">                </span>EmbeddedObject(myField == AnEnum.SomeOtherValue) from $c.embedded</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">        </span>then</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod("someOtherValue")</font></div><div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod2(50)</font></div>
<div><font face="Monaco"><span style="white-space:pre-wrap">                </span>$a.someMethod3(B)</font></div><div><font face="Monaco">end</font></div><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">
<br></font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div><div>
<span style="border-collapse:separate;border-spacing:0px"><div>Ramon Buckland</div><div><a href="mailto:ramon@thebuckland.com" target="_blank">ramon@thebuckland.com</a></div><div><br></div></span><br>

</div>


<br></div></font></span></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></blockquote></div><br></div>
_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-users</blockquote></div><br></div></body></html>