[rules-users] Re: eval() not working as expected

Brian Enderle brianke at gmail.com
Tue Sep 25 17:00:57 EDT 2007


>    Best way to know is preview your DRL rule in IDE and check what is wrong 
(or paste it here).   []s   Edson


Here is the working rule:

rule "LevelTwo: MEPS Processing cannot be blank if Projection exists"
	agenda-group "LevelTwo"
	when
>		$i : MepsProcessing(eval(mepsProjTypCd != null) && eval
(mepsProjTypCd != ' '), eval(StringUtils.isBlank(mepsId)))
	then
>		System.out.println("Meps Id cannot be blank");
end

When I replace the two conditions with a DSL entry, the rule works with the 
DSL conditions individually as in:

		There is a MepsProcessing
			- mepsProjTypCd is not a blank Character

or

		There is a MepsProcessing
			- mepsId is a blank String


But as soon as I put the two conditions together I get the error.

rule "LevelTwo: MEPS Processing cannot be blank if Projection exists"
	agenda-group "LevelTwo"
	when
		There is a MepsProcessing
			- mepsProjTypCd is not a blank Character
			- mepsId is a blank String
	then
>		System.out.println("Meps Id cannot be blank");
end

Error: 
Caused by: org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule 
name=LevelTwo: MEPS Processing cannot be blank if Projection exists, 
agendaGroup=LevelTwo, salience=0, no-loop=false]
	mil/army/usaac/ariss/dca/bp/Rule_LevelTwo__MEPS_Processing_cannot_be_bl
ank_if_Projection_exists_0.java (33:1686) : Syntax error on token ",", . 
expected
	mil/army/usaac/ariss/dca/bp/Rule_LevelTwo__MEPS_Processing_cannot_be_bl
ank_if_Projection_exists_0.java (33:1713) : mepsId cannot be resolved


Any ideas,
Brian Enderle


> https://lists.jboss.org/mailman/listinfo/rules-users
> 







More information about the rules-users mailing list