Re: [rules-users] Without salience
If it works with salience, why change ? And why is the order so important ? Still trying to get the first occurence of an event of a given type/value ? It remembers me some not-so-old post ... - Mail original - De: salt writemesaltwo...@gmail.com À: rules-users@lists.jboss.org Envoyé: Mardi 4 Septembre 2012 06:17:16 Objet: [rules-users] Without salience Hi All, For the below use case i have implemented the rule. Please suggest other way of doing without salience. scenario ITEMS AMOUNT OCCNO PASS 10 1 FAIL 10 2 PASS 15 3 PASS 25 4 rule HelloWorld_14 salience (65522- $list.indexOf( $transdet1 )) when $p1:Passes($list : transaction) $trans1:Transaction(items in (PASS)) from $list $p2:Passes() not(exists($transdet5:Transaction(items in (FAIL),value==$transdet1.getVaue(), occno$trans1.getOccno()) from $p2.transaction)) then System.out.println($trans1.getOccno()); end The above will return 3 4 (not 4,3) Kindly suggest other way of doing this without salience. Thanks Salt -- View this message in context: http://drools.46999.n3.nabble.com/Without-salience-tp4019565.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Without salience
The rule is very peculiar, and I'm not sure what you want to find with it. See below. On 04/09/2012, salt writemesaltwo...@gmail.com wrote: rule HelloWorld_14 salience (65522- $list.indexOf( $transdet1 )) when $p1:Passes($list : transaction) $trans1:Transaction(items in (PASS)) from $list $p2:Passes() not(exists($transdet5:Transaction(items in (FAIL),value==$transdet1.getVaue(), occno$trans1.getOccno()) from $p2.transaction)) Why are you using the complex in operator when you test against a single String value? I suppose getVaue() contains a typo. There is an unbound variable $transdet1. The 3rd and 4th conditional elements match another Passes fact, which could be the one bound to $p1 - or not. If you mean that $p1 == $p2, simply omit the second CE with Passes and use $p1. Don't use different accesses for the same thing (i.e., $list vs. $p1.transation) as this is confusing. -W then System.out.println($trans1.getOccno()); end The above will return 3 4 (not 4,3) Kindly suggest other way of doing this without salience. Thanks Salt -- View this message in context: http://drools.46999.n3.nabble.com/Without-salience-tp4019565.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Without salience
Hi All, For the below use case i have implemented the rule. Please suggest other way of doing without salience. scenario ITEMSAMOUNT OCCNO PASS 10 1 FAIL 102 PASS 15 3 PASS 25 4 rule HelloWorld_14 salience (65522- $list.indexOf( $transdet1 )) when $p1:Passes($list : transaction) $trans1:Transaction(items in (PASS)) from $list $p2:Passes() not(exists($transdet5:Transaction(items in (FAIL),value==$transdet1.getVaue(), occno$trans1.getOccno()) from $p2.transaction)) then System.out.println($trans1.getOccno()); end The above will return 3 4 (not 4,3) Kindly suggest other way of doing this without salience. Thanks Salt -- View this message in context: http://drools.46999.n3.nabble.com/Without-salience-tp4019565.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users