[rules-users] Trouble adding things to a list

Grimshaw, Jeffrey Jeffrey.Grimshaw at greenpoint.com
Sat Mar 10 19:30:57 EST 2007


Hi all.  I've got some rules that are supposed to add documents to a
list that is then returned to the caller.  Each rule sets some
properties on a document and then adds it to the list.  The correct
number of objects are being added to the list, but each object has the
attributes that were set in the first matching rule.  It seems as if the
properties on the object can be set only once and cannot be changed by
subsequest rules.

Here's the comlete DRL:

package com.mycompany.rules.documentlist;
#generated from Decision Table
import com.mycompany.rules.documentlist.*;
#From row number: 11
rule "DocumentList_11"
	
	when
		document : DocumentAttributes()
		docList : DocumentList()
	then
		document.setAllowActivityCompletion(false);
		document.setName("Document 1");
		document.setTypeID(100);
		document.setHelpFile("Help File");
		docList.addDocuments(document);
end

#From row number: 12
rule "DocumentList_12"
	
	when
		document : DocumentAttributes()
		docList : DocumentList()
	then
		document.setDisplayDocument(true);
		document.setName("Document 2");
		document.setTypeID(101);
		document.setHelpFile("Help File");
		docList.addDocuments(document);
end

As you can see, the DRL was generated from a decision table, but I don't
think that has anything to do with the behavior I'm seeing.  The
document bound variable is set correctly and added to the list in the
first rule, but the second rule adds the same document as was added in
the first rule.

Any suggestions as to what is going on here would be much appreciated.
Is it even possible to get there from here?  I tried setting
Sequential=true on the decision table, but that does not help.

Thanks,

Jeff Grimshaw
Sr. Programmer/Analyst
Green Point Mortgage






More information about the rules-users mailing list