Hi,<br><br>Yes it is possible but I think the function has to return an int. Also, it should be called as follows:<br><br>rule "Periode@{row.rowNumber}"<br> salience ( getNbJours("@{ddeb}",
"@{dfin}") );<br><br>Include the stack trace from the NPE if this doesn't work.<br>Cheers,<br>Enda<br><br><br><div class="gmail_quote">2010/3/10 Bertrand Grottier <span dir="ltr"><<a href="mailto:b_grottier@hotmail.com">b_grottier@hotmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
Hello,<br><br>Is it possible to specify a template salience such as:<br><br>function long getNbJours(String pStrDDeb, String pStrDFin)<br>{<br> SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");<br> <br>
Date dDeb = sdf.parse(pStrDDeb) ;<br> Date dFin = sdf.parse(pStrDFin) ;<br><br> long diff = dFin.getTime() - dDeb.getTime() ;<br> <br> return (diff / (24 * 60 * 60 * 1000)) ;<br>}<br><br>template "tarification_produit"<br>
<br>rule "Periode@{row.rowNumber}"<br> salience getNbJours("@{ddeb}", "@{dfin}")<br> when<br> $p : Produit(id == 1, eval( dDeb.before( getDate("@{ddeb}") ) ) )<br> then<br>
$p.setId(2) ; <br> $p.setPrix(@{prix}) ;<br> update( $p ); <br>end<br>end template<br><br>I encounter a java.lang.NullPointerException.<br><br>Thank you in advance for your help.<br><br>Regards,<br>
<br>Benoît<br>                                            <br><hr>Acheter en ligne en toute sécurité ? <a href="http://clk.atdmt.com/FRM/go/206608211/direct/01/" target="_blank">Internet Explorer 8 vous protège gratuitement !</a></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 clear="all"><br>-- <br>Enda J Diggins<br>