I'd assume the intention was to use the support mvel provides for abbreviating
expressions - so it is intended to be interpreted as shorthand for 20 <= price
&& price < 30. I'm not 100% sure scanning through the docs whether this
form is correct or not.
Thomas
-----Original Message-----
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-
bounces(a)lists.jboss.org] On Behalf Of Wolfgang Laun
Sent: 05 February 2012 12:22
To: Rules Users List
Cc: Rules Dev List
Subject: Re: [rules-users] How to write rules in two fact's fields?
In most programming languages the result of (e.g.) an integer comparison
20 <= price
is a value of a different type, i.e., boolean, with values "true" or
"false". (You
have heard this at some time, right?) Consequently, the comparison of a
boolean with an integer
true < 30
depends on whether the language tolerates it, and if so, how that result is
defined.
IT IS A BUG THAT DROOLS TOLERATES (BUT DOES NOT DEFINE) SUCH
"MULTIPLE" COMPARISONS BUT DOES NOT FLAG THEM AS AN ERROR OR
IMPLEMENT THEM IN SOME WAY. (Tested with 5.3.0 Final.)
This means that you'll have to rwrite your constraints using && or ||, as
appropriate.
-W
On 05/02/2012, shanmuga <shanmugasundaram.t.v(a)gmail.com> wrote:
> Hi,
> I want to know, how to write rules in two fact's fields?
>
> I used two facts, it will take AND condition or OR condition in
> between the two facts.
>
> Please check my code....
>
> package Project
> import com.sample.Person;
> import com.sample.Price;
>
> rule "rule_Name"
> when
> per:*Person*(50 <= age < 100, 10000 <= income < 50000,
> occupation == "Business", category == "Military", location ==
> "Bangalore", custype ==
> "Individual")
> pri:*Price*((20 <= price < 30) || price == 1)
> then
> System.out.println("Success");
> end
>
>
> The both fact values are satisfy means, what is the output?
>
> I got output, even the *Price* fact's value is wrong. (price == 100)
>
> Please slove my problem........!!!!
>
> --
> View this message in context:
>
http://drools.46999.n3.nabble.com/How-to-write-rules-in-two-fact-s-fie
> lds-tp3717063p3717063.html Sent from the Drools: User forum mailing
> list archive at
Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
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
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received
this message in error, please immediately notify the postmaster(a)nds.com and delete it from
your system as well as any copies. The content of e-mails as well as traffic data may be
monitored by NDS for employment and security purposes. To protect the environment please
do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United
Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603
8808 40-00
**************************************************************************************