cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving child collection in a Transaction step

Former Member
0 Kudos

Hi,

I am trying to retrieve a child collection of a parent object in a java steplet of a transaction step. Example:

Customer object has a collection of order objects. A transaction has been defined for Customer object and order collection is also one of the transaction properties. I am able to access the customer object properties like name and id using transactionSession.getSessionData.getString('transaction.customerName'). How can I access the order collection in this case??

Thanks in advance

Amitoj Singh

Tags edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I found the solution to the problem, so sharing for everyone's reference:

In order to fetch collection property values in a transaction, use the following code in the steplet under the constructor with transaction session property:

for(int i=0; i< collection.size; i++)

{

transactionSession.getSessionData.getString("transaction.orderCollection."+ i + "orderId")

}

// follow the same steps for other properties whose values you want to fetch.

Regards

Amitoj Singh

jason_latko
Advisor
Advisor
0 Kudos

Amitoj,

You are missing a period before your property name in the transactionSession line.  It should be:

transactionSession.getSessionData.getString("transaction.orderCollection."+ i + ".orderId")

The collection is accessed using: "Transaction.CollectionName.Instance.PropertyName"

Instance is a zero based array of the objects in the collection.

Jason Latko - Senior Product Developer at SAP

Answers (0)