on 02-22-2014 9:20 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.