[rules-users] Without salience

Wolfgang Laun wolfgang.laun at gmail.com
Tue Sep 4 06:30:00 EDT 2012


The rule is very peculiar, and I'm not sure what you want to find with
it. See below.

On 04/09/2012, salt <writemesaltworth at 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 at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list