[rules-users] compare string and int in LHS

brenner daniel.brenner at isg-stuttgart.de
Fri Feb 8 07:33:07 EST 2008


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.




More information about the rules-users mailing list