Also, I tried putting an underscore in front of the variable name, like in your 
code.  Still no problem with Dools 5.4. (Project attached.)


________________________________
 From: Greg Barton <[email protected]>
To: Rules Users List <[email protected]> 
Sent: Friday, October 26, 2012 1:34 PM
Subject: Re: [rules-users] refactoring "complex" conditon to use "in" operator
 

I couldn't reproduce with Drools 5.4.  If you can recreate the problem with the 
version of drools you're using on a test project like the one attached submit a 
JIRA.


________________________________
 From: "Cotton, Ben" <[email protected]>
To: Rules Users List <[email protected]> 
Sent: Friday, October 26, 2012 1:07 PM
Subject: Re: [rules-users] refactoring "complex" conditon to use "in" operator
 

  
No, that’s not it.  Using “1.0” causes the exact same syntax error.
 
From:[email protected] 
[mailto:[email protected]] On Behalf Of Greg Barton
Sent: Friday, October 26, 2012 2:03 PM
To: Rules Users List
Subject: Re: [rules-users] refactoring "complex" conditon to use "in" operator
 
Maybe because the 1.0 is in single quotes, and not double quotes, like the 
others?
 

________________________________
 
From:"Cotton, Ben" <[email protected]>
To: Rules Users List <[email protected]> 
Sent: Friday, October 26, 2012 12:15 PM
Subject: [rules-users] refactoring "complex" conditon to use "in" operator
 
Hi,
 
The following rule is working well.
 
rule"foo"
when
        Message(_initialStubRate == "1.0") ||
            Message(_initialStubRate == "2.0") || (
                Message(_initialStubRate >= "4.0") &&
                Message(_initialStubRate <= "44.0")
            ) ||
            Message(_initialStubRate == "52.0")
then
    System.out.println("foo");
End
 
To make this logic more amenable to being generically rendered via .DRT 
template, I want to simplify this rule .  Consider the following re-factoring.
 
rule"bar"
when
         Message(_initialStubRate in(
                '1.0',"2.0",
                    "4.0","5.0","6.0","7.0","8.0","9.0","10.0", "11.0",  
"12.0","13.0",
                    "14.0","15.0","16.0","17.0","18.0","19.0","20.0", "21.0",  
"22.0","23.0",
                    "24.0","25.0","26.0","27.0","28.0","29.0","30.0", "31.0",  
"32.0","33.0",
                    "34.0","35.0","36.0","37.0","38.0","39.0","40.0", "41.0",  
"42.0","43.0",
                    "44.0",
                    "52.0")
         )
then
    System.out.println("bar");
end
 
This re-facotred rule produces a syntax error in Eclipse’s .DRL view.   
 
BuildError: Unable to Analyse Expression_initialStubRate == "1.0" || 
_initialStubRate == "2.0" || _initialStubRate == "4.0" || _initialStubRate == 
"5.0" || _initialStubRate == "6.0" || _initialStubRate == "7.0" || 
_initialStubRate == "8.0" || _initialStubRate == "9.0" || _initialStubRate == 
"10.0" || _initialStubRate == "11.0" || _initialStubRate == "12.0" || 
_initialStubRate == "13.0" || _initialStubRate == "14.0" || _initialStubRate == 
"15.0" || _initialStubRate == "16.0" || _initialStubRate == "17.0" || 
_initialStubRate == "18.0" || _initialStubRate == "19.0" || _initialStubRate == 
"20.0" || _initialStubRate == "21.0" || _initialStubRate == "22.0" || 
_initialStubRate == "23.0" || _initialStubRate == "24.0" || _initialStubRate == 
"25.0" || _initialStubRate == "26.0" || _initialStubRate == "27.0" || 
_initialStubRate == "28.0" || _initialStubRate == "29.0" || _initialStubRate == 
"30.0" || _initialStubRate == "31.0" || _initialStubRate == "32.0" ||
 _initialStubRate == "33.0" || _initialStubRate == "34.0" || _initialStubRate 
== "35.0" || _initialStubRate == "36.0" || _initialStubRate == "37.0" || 
_initialStubRate == "38.0" || _initialStubRate == "39.0" || _initialStubRate == 
"40.0" || _initialStubRate == "41.0" || _initialStubRate == "42.0" || 
_initialStubRate == "43.0" || _initialStubRate == "44.0" || _initialStubRate == 
"52.0":
[Error: no such identifier: _initialStubRate]
[Near : {... _initialStubRate == "1.0" || _ ....}]
 
 
             ^
[Line: 1, Column: 1]
 
 
What could be wrong?
 
Ben D Cotton III
Morgan Stanley & Co.
OTC Derivatives Clearing Technology 
1221 AOTA Rockefeller Ctr - Flr 27
New York, NY 10020
(212)762.9094
[email protected] 
 
 
 

________________________________
 

NOTICE: Morgan Stanley is not acting as a municipal advisor and the opinions or 
views contained herein are not intended to be, and do not constitute, advice 
within the meaning of Section 975 of the Dodd-Frank Wall Street Reform and 
Consumer Protection Act. If you have received this communication in error, 
please destroy all electronic and paper copies and notify the sender 
immediately. Mistransmission is not intended to waive confidentiality or 
privilege. Morgan Stanley reserves the right, to the extent permitted under 
applicable law, to monitor electronic communications. This message is subject 
to terms available at the following link: 
http://www.morganstanley.com/disclaimers If you cannot access these links, 
please notify us by reply message and we will send the contents to you. By 
messaging with Morgan Stanley you consent to the foregoing.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users



________________________________
 
NOTICE: 
Morgan Stanley is not acting as a municipal advisor and the opinions or views 
contained herein are not intended to be, and do not constitute, advice within 
the meaning of Section 975 of the Dodd-Frank Wall Street Reform and Consumer 
Protection Act. If you have received this communication in error, please 
destroy 
all electronic and paper copies and notify the sender immediately. 
Mistransmission is not intended to waive confidentiality or privilege. Morgan 
Stanley reserves the right, to the extent permitted under applicable law, to 
monitor electronic communications. This message is subject to terms available 
at 
the following link: http://www.morganstanley.com/disclaimers If you cannot 
access these links, please notify us by reply message and we will 
send the contents to you. By messaging with Morgan Stanley you consent to the 
foregoing.

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Attachment: DroolsIn.tar.gz
Description: GNU Zip compressed data

_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to