Anthony Castillon

Populating an object's array property in decision tree action node

Discussion created by Anthony Castillon on Apr 5, 2013
Latest reply on Nov 27, 2014 by jiten.panna@tcs.com

I created a decision tree with an object (RequestInfo) as a parameter. RequestInfo has a an array of RequestApprover as a property.  The decision tree is supposed to populate the approver array based on the values of the other properties in the RequestInfo object.

 

I have a couple of questions:

1.  In the action node in the decision tree, I add rows to populate the different elements in the approver array (by array index).  However, when I try to output the approvers using a SRL loop, I get the entries for the last array index and I don't see the other array values properly.  How do I populate the approver array in an action node?

 

2.  How should I properly initialize the RequestApprover array, which is a dynamic array?  If I use the following code

 

testApprover is a RequestApprover initially {
 it.roleName = "test".
}

myApprovers is an array of RequestApprover.

myRequest is a RequestInfo initially {
 it.requestID = "1234546834".
 it.requestType = "Contract".
 it.amount = 4500000.00.
 it.approvers = myApprovers.
}.

 

It does not populate the array and I get the following exception:

 

com.blazesoft.engines.rules.NdEvaluationException: Evaluation error
Expression produces unexpected value: Invalid index: 0.

 

If I use the code below to initialize the array, I don't get the error but it does not reflect the actually array count from the decision tree, i.e. even if the actually count is 2, it will iterate over 9 elements.

 

myApprovers is an array of RequestApprover  initially {
 it[0] = testApprover,
 it[1] = testApprover,
 it[2] = testApprover,
 it[3] = testApprover,
 it[4] = testApprover,
 it[5] = testApprover,
 it[6] = testApprover,
 it[7] = testApprover,
 it[8] = testApprover.
}

 

 

Thanks.

Outcomes