我在表格中有以下数据 -
ID ABC_23_02
-- --------
01 See your note and security instrument for information about
-what happens if you fail to make your payments,
-what is a default on the loan.
现在,我希望在列中找到相同的值时触发规则。这是我的代码片段 -
rule "Rule - Success"
when
form: Form_ABC()
$m: Map()
$ID: Object() from $m["ID"]
$x: Object() from $m["ABC_23_02"]
Map(Utility.rtnString($x) == "See your note and security instrument for information about\n-what happens if you fail to make your payments,\n-what is a default on the loan.")
then
Utility.helper(drools);
if(!($ID.toString().equalsIgnoreCase("ID")))
{
form.setCD_23_02(Utility.rtnString($x));
System.out.println("Rule - Pass\t\t" + $ID.toString()
+ "\tField 1 is: " + $x.toString());
}
end
而且,这是我正在调用的Utility.rtnString($ x)函数 -
public static String rtnString(Object Input) {
//String numOnly = Input.toString().replaceAll("[^\\w\\s\\.]","");
String numOnly = Input.toString().replaceAll("[^\\w\\s\\.\n]","");
return numOnly.toUpperCase();
}
但是,我无法使用上面的内容在列中查找字符串。你能否提出一个更好的方法来实现同样的目标。感谢。