You could use an inline eval too. The problem possibly lies more with your model; why not have one subclass expose the String property and another the Integer property and code the rules using the subclasses? Much safer throughout the entire application than having to worry whether some field is meant to be a string or number (It's very easy to question problems though - there could be very good reason why you need the model "as is").
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of brenner Sent: 08 February 2008 12:33 To: [email protected] Subject: Re: [rules-users] compare string and int in LHS Hi, I have found a solution, but I don't know that it is the best: My solution: I have extend my Class with a method which returns the string as a integer. And my rule is like this: i : Integer( intValue <= 1) from $test.getValue(Test.VALUE_TYP_INTEGER); Is that the only/best solution. Can't I convert Strings to Integer on the LHS of a rule? greeting Daniel brenner wrote: > > Hi, > > I have a class, wich contains a string value. This value is in some use > cases an integer. > For this use case I want to convert (parse) the string typ to an integer > because I want that the following rule matches: > > rule > when > t : Test(value <= 1) > then > System.out.println(t) > end > > > class Test { > > String value; > > getValue(); > setValue(); > > } > > Have anyone a solution or some help for me? > Is that possible what I want to do? > > Thanks > Daniel > -- View this message in context: http://www.nabble.com/compare-string-and-int-in-LHS-tp15337728p15354435.html Sent from the drools - user mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
