you can affect&nbsp; a numero to salience in fact salience is used to give a priority to rule and the rule who has the numero of salience more priority<br>rule "Price Product rule using price length"<br>salience 500 ( for exemple&nbsp; )<br>    when<br>        $s : Product (length &gt; 0)<br>        $price : Price($length: length)<br>    then<br>        $s.setAmount($s.getAmount() + $price.getAmount());<br>        $s.setLength($s.getLength() - $length.intValue());<br>        modify($s);<br>end<br><br><br><b><i>Maxime &lt;mcatelin@perinfo.com&gt;</i></b> a écrit&nbsp;:<blockquote class="replbq" style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"> Hello,<br><br>I'm trying to find how to manage priority within a rule.  Let me explain <br>the problem. I'll try to be as clear as possible but bear with me since <br>I am new to rules. <br><br>We have two objects, the Product is the object I'm trying to price and <br>the object Price is the one
 that knows all the prices. Both products and <br>prices have fields amount and length.  Product amount is initialized to <br>0 and prices are going to determine the product amount depending on its <br>length.<br><br>Let's see an example :<br><br>Product : P -&gt; length = 5, amount = 0<br>Price : P1  -&gt; length = 1, amount = 50<br>Price : P2  -&gt; length = 3, amount = 100<br><br>With this configuration, after asserting the 3 objects to the WM, the <br>amount field of Product P should have a value of 200 ( 1*100 + 2*50) <br>because the price with the greatest length should be favored over the <br>other ones.<br><br>Here is the rule I made :<br><br>rule "Price Product rule using price length"<br>    when<br>        $s : Product (length &gt; 0)<br>        $price : Price($length: length)<br>    then<br>        $s.setAmount($s.getAmount() + $price.getAmount());<br>        $s.setLength($s.getLength() - $length.intValue());<br>        modify($s);<br>end<br><br>This is
 obviously wrong because it always takes the first asserted price <br>object.  I don't know how to make a rule which would take the amount of <br>the price object with the greatest length in priority.<br><br>Any help would be very much appreciated.<br><br>Cheers,<br><br>Max<br><br>_______________________________________________<br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></blockquote><br><p>&#32;
                <hr size="1"> 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur <a href="http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com">Yahoo! Questions/Réponses</a>.