[rules-users] Inline eval problem!

vanshi nilu.thakur at gmail.com
Tue Dec 2 00:08:50 EST 2008


I need to convert a variable from string to intger in the rule. That variable
here is rank, so, I create a helper class called 'Conversion' with just one
function/method, which is supposed to convert the string argument passed to
it, to an integer and then I call that method in rule as inline eval. What's
wrong here because this is not working and I don't want to change 'When'
part too much because it has 10 or so other variable with && connective,
which I've removed for clarity here. Any input would be appreciated much.

package harules;
import com.hibernate.Person;
import com.uhg.utils.Conversion;

rule "one"
salience 10
	when
	$con: Conversion();
	pers: Person(age!= null , age >= 18 , eval($con.getInteger(rank) > 140))
	then
	System.out.println("Evaluated true");
end

//content of Conversion class
package com.utils;
public class Conversion {
public Integer getInteger(String s)
{
	return Integer.parseInt(s);
}
}
-- 
View this message in context: http://www.nabble.com/Inline-eval-problem%21-tp20786253p20786253.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list