you have two patterns, there for you need two objects - it's a cross
product. Try using an eval instead of a predicate, then you can bind all
your variables on the first line, and eval them on the next line.
Until you move to 4.0 there is no clean way to do this.
Mark
Natraj Gudla wrote:
Yes, infact i expected both the conditions to work against the same
object in the working memory? Is it not possible?
For this scenario, drools has not been allowing me to do a comparison
amongst two attributes of the same class. When i do so, it complains
of not being to resolve the variable.
Some thing like a1 > a2 does not work. I am forced to create a
declaration and then use it to compare. If i do so, the run time thing
fails.
How do i get around to compare two attributes from the same class.
Something like
a1 > a2 or say a1 > (a2 * 1.5)
Thanks
Natraj
On 7/19/07, *Mark Proctor* <mproctor(a)codehaus.org
<mailto:mproctor@codehaus.org>> wrote:
You do understand that what you have there is a cross product,
you'll need two objects to match against that - were you expecting
this to wokr against and on the same single EMIAgainstProperty
object?
Mark
Natraj Gudla wrote:
> I am facing some serious blocking issues while writing few rules.
> In the rule below, a1, a2 are Double objects. When i have the
> first statement in the rule " EMIAgainstProperty( obj : a1 )",
> the rule does not fire....when i comment and re phrase the second
> line as emi : EMIAgainstProperty( a2 >= ( *new* Double(10* 1.5 ))
> ), the rule is fired.
>
> Why is the first line making the rule not to fire. I have
> reported a similar problem yesterday, but could not find a
> resolution. On the other hand, i am unable to refer a1 directly
> to say a1.doubleValue () in the second line, it throws up and
> error. Any help??? What is the way out?
> *
>
> rule
>
> *"Test" *when*
>
> EMIAgainstProperty( obj : a1 )
>
> emi : EMIAgainstProperty( a2 >= (
>
> *new* Double(obj.doubleValue() * 1.5 )) ) *then*
>
> System.out.println(
>
> " Passed ");*
>
> end
>
> *
> ------------------------------------------------------------------------
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org <mailto:rules-users@lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/rules-users
<
https://lists.jboss.org/mailman/listinfo/rules-users>
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users