cancel
Showing results for 
Search instead for 
Did you mean: 

Adding values from one collection into the other

Former Member
0 Kudos

Hi Experts,

I am using agentry editor and I need some suggestions for the follwoing scenario :

I have 2 objects Employee Details and Departments with collections EmployeeCollection and DeptCollection respectively. Employee details object has a property DeptName which is empty. I want to fill the employee collection with the department name data and display it in a list tile view. The list tile view carries the Employee collection.

I tried to use a sub action which would loop over the department collection and tried to fill department names into the employee collection but was unsuccessful. How can get the value from deptcollection and fill it into the employee collection?.(Is it possible to obtain values from one collection and use them in another.)

p.s. Both the objects have deptName property, other than that there is no connection between the two.

Please provide some suggestions on how to go about this.

Thanks in advance

Amitoj Singh 

Accepted Solutions (1)

Accepted Solutions (1)

jason_latko
Advisor
Advisor
0 Kudos

Amitoj,

If both objects have only a deptName property in common and the employee deptName is always blank to begin, then I don't see how you would know which department names belong to each employee?  It seems you would need a department number in both that is populated.  Then you could loop over employees in a sub-action and look up the correct department record (based on department number key) and retrieve the department name to store in the employee.  Does this sound right to you?

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason,

Thanks for the reply.

What if my employee collection is empty? In that case can I fill the empty collection property with the department names??

The problem I'm facing is that one of the collections is empty and i want to be able to fetch particular values into the empty collection from another collection property.

Thanks

Amitoj   

jason_latko
Advisor
Advisor
0 Kudos

Amitoj,

Yes that is a common and easy task, but what good is an empty employees collection?  Where will the employee names, etc.. come from?  Anyway, here is how to accomplish it:

Create a new action LoopOverDepartments.

Loop over your Departments collection in a sub-action step, then finish the LoopOverDepartments with a single Apply that will commit all the added records.

Tie the AddEmployee action to the sub-action.

AddEmployee runs the AddEmployee transaction.  This transaction adds a new record to your collection target.

For your deptName property, set initial value to: "From Other Object Property".  Then set the other property field using the object browser to "Department Object -> deptName property".  This will use the value from the current Department record that we are looping over.

You will also need to provide a unique value for the key property of each record in the Employee collection.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Hi Jason

Thanks for the help. 

This is kind of what I was looking for. After filling the empty collection, I want to display it in a list tile view and through that I'll run an edit transaction where I will fill the rest of the employee object fields and save them.

Thanks & Regards

Amitoj

Answers (0)