[rules-users] Multiple variables problem..

skasab2s skasab2s at smail.inf.fh-brs.de
Mon Sep 19 13:36:45 EDT 2011


Hello,

I have a rule file with multiple boolean variables. Currently, I declare a
new wrapper object for every single variable

/declare Object1
  value : boolean
end

declare Object2
  value : boolean
end
/

The approach works fine, but when I try wrapping the two variables in one
object a not desired effect happens: see code:

/declare ObjectOneTwo
  value1 : boolean
  value2 : boolean
end

rule "first rule"
  when 
      ObjectOneTwo (value1 == false)
  then
      set ObjectOneTwo.value1 to 'true'
  end

rule "second rule" 
  when 
     ObjectOneTwo (value2 == false)
 then
    set ObjectOneTwo.value2 to 'true'  /
 end
In the second rule, we modify the same object ObjectOneTwo again which
causes "fist rule" to fire again although this is not desired. Do you know
how to avoid this effect and still have one wrapper object for all
variables?

Thanks in advance!

Svetlomir.





--
View this message in context: http://drools.46999.n3.nabble.com/Multiple-variables-problem-tp3349281p3349281.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list