You must insert a magic spell string to make this work ;-)<br><br>Look at this line:<br><br> String(FactorKeys.PHONE_PACKAGE memberOf ownedProductFactorSet)<br><br>It says: "If there is an object of type java.lang.String and..." And so you must insert a String!<br>
<br>But, of course, you don't need <i>this </i>condition. You just want to make sure that FactorKeys.PHONE_PACKAGE is contained in the global ownedProductFactorSe.<br>You should write this as<br> eval( ownedProductFactorSet.contains( FactorKeys.PHONE_PACKAGE ) )<br>
Also, this line should be the first line, because it is a constant condition.<br><br>(If you do insert an arbitrary String object, the rule will work, but only up to version 5.1.1.<br>5.2.x has a different parser that refuses incorrect constraints.)<br>
<br>-W<br><br><br><div class="gmail_quote">On 17 May 2011 19:56, dxande6 <span dir="ltr"><<a href="mailto:dxande6@qwest.com">dxande6@qwest.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm trying to validate that there is a Factor in a collection using the<br>
global variable ownedProductFactorSet. I'm having trouble. I do not get an<br>
error, it just doesn't resolve to true. I've validated the<br>
ownedProductFactor set has the Factor<br>
<br>
Java class that is contained withing the ownedProductFactorSet:<br>
<br>
Factor<br>
String key<br>
String value<br>
<br>
Here is the code in the drl:<br>
<br>
global Set ownedProductFactorSet;<br>
<br>
rule "Owned Products"<br>
ruleflow-group "discount-pricing"<br>
lock-on-active true<br>
when<br>
not Factor(key == FactorKeys.DISCOUNT)<br>
String(FactorKeys.PHONE_PACKAGE memberOf ownedProductFactorSet)<br>
Factor(key == RulesKeys.WIRELESS)<br>
<br>
then<br>
logger(kcontext).info("SUCCESS - *******************************");<br>
insert(new Factor(FactorKeys.DISCOUNT)); end<br>
<br>
It never gets to the consequence (RHS - "then" part) of this rule.<br>
If I comment out the following line:<br>
String(FactorKeys.PHONE_PACKAGE memberOf ownedProductFactorSet) It<br>
will work.<br>
<br>
Any help with the memberOf keyword is greatly appreciated.<br>
<br>
Thanks,<br>
<br>
-dxande6<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Drool-5-memberOf-problem-tp2953475p2953475.html" target="_blank">http://drools.46999.n3.nabble.com/Drool-5-memberOf-problem-tp2953475p2953475.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>