Maybe because the 1.0 is in single quotes, and not double quotes, like the others?


From: "Cotton, Ben" <Ben.Cotton@morganstanley.com>
To: Rules Users List <rules-users@lists.jboss.org>
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
ben.cotton@ms.com
 
 




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
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users