<div dir="ltr">Hello,<br><br>I have a rule which creates an object in the consequence part and updates this object each time teh rule is executed. So the object has to be created only the first time.<br>So I always need two rules, one init rule which creates the object if it doesn't exist yet and one if it already exists and it should only be updated:<br>
<br>rule "init rule"<br>when<br> "condition"<br> AND <br> not OutputObject()<br>then<br> OutputObject oo = new OutputObject();<br> insert(oo);<br><br>rule "update rule"<br>when<br>
"condition"<br>
AND <br>
oo: OutputObject()<br>
then<br> #do something with the object<br>
update(oo);<br><br>But is it really neccessary to write an extra rule only to create the output-fact initially? Is it possible/good style to make this in one single rule? <br><br>Appreciate your help.<br><br>Regards<br>
Thomas<br></div>