It seems that some template/CSV parser expects the parameters in the same order as the column headers of the CSV. Also, there is no explicit termination of the parameter list, and therefore the parser appears to rely on "package" being the first statement of the header text to precede all expansions. <br>
<br>At least, it should be documented.<br><br>-W<br><br><br><div class="gmail_quote">2011/11/3 Bruno Freudensprung <span dir="ltr"><<a href="mailto:bruno.freudensprung@temis.com">bruno.freudensprung@temis.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><u></u>
<div text="#000000" bgcolor="#ffffff">
<br>
Hi Wolfgang,<br>
<br>
Sure. Please find attached a small Maven/Eclipse project containing
3 DRT and 3 unit test cases (Java in src/test/java/org/drools/bug,
rules in src/test/resource/org/drools/bug) :<br>
<ul>
<li>Test1OK(.java/.drt/.csv) is the one working well<br>
</li>
<li>Test1KO(.java/.drt/.csv) is the one illustrating the 1)
behavior</li>
<li>Test1KO2(.java/.drt/.csv) is the one illustrating the 2)
behavior</li>
</ul>
Regards,<br>
<br>
Bruno.<br>
<br>
Le 03/11/2011 14:07, Wolfgang Laun a écrit :
<div><div></div><div class="h5"><blockquote type="cite">Before you work on a JIRA could you please provide an
(abbreviated) example of a template that causes both errors?<br>
-W<br>
<br>
<div class="gmail_quote">2011/11/3 Bruno Freudensprung <span dir="ltr"><<a href="mailto:bruno.freudensprung@temis.com" target="_blank">bruno.freudensprung@temis.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff"> Hi all,<br>
<br>
I am writing rules using Drools Templates and I noticed
strange problems (ocurring when I slightly modify a DRT that
works well): <br>
<ol>
<li>the template instanciation depends on the declarations
order of the parameters in the template header</li>
<li>if the rule template does not contain a package
declaration (default package) the instanciation of the
template fails</li>
</ol>
I am working with Drools 5.1.1 but those problems occur in
5.2.0.Final and in 5.3.0.Final as well.<br>
Do you think it is worth posting a JIRA?<br>
<br>
Anyway let me tell you that Drools Templates are great! Our
users like that feature a lot! They start writing a rule in
DRL format and, once it works, they transform it into a DRT
and put data into a tsv file. It is quite a natural way of
working. The general perception here is that it is easier to
"templatize" an existing DRL than to write a decision table
from scratch.<br>
<br>
Best regards,<br>
<br>
Bruno.<br>
<br>
PS:<br>
<br>
<u>DRT that works well</u>:<br>
<br>
<tt>template header<br>
<b>name<br>
message<br>
<br>
package templates;<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template<br>
</tt><br>
<u>DRT that does not work</u> (first case):<br>
<br>
<tt>template header<br>
<b>message<br>
name<br>
<br>
package templates;<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template</tt><br>
<br>
<br>
<u>DRT that does not work</u> (second case):<br>
<br>
<tt>template header<br>
<b>name<br>
message<br>
</b><br>
import org.drools.bug.Entity;<br>
<br>
template "TestTemplate"<br>
rule "Test1 @{row.rowNumber}"<br>
dialect "mvel"<br>
when<br>
Entity( $name : name == "@{name}" )<br>
then<br>
System.out.println("@{message}" + $name);<br>
insert($name);<br>
end<br>
end template</tt><br>
<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>
<pre><fieldset></fieldset>
_______________________________________________
rules-users mailing list
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<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>