Map: 2 record List to One Record List

I have a problem with webMethods

I have 2 record list in input and I whant to map it and output it to a single record list.

Ex: Input
        <Lender>......</lender>
       <Lender>......</lender>
        <Borrower>...</Borrower>
        <Borrower>...</Borrower>

Output

    <party> Lender1 </party>
    <party> Lender2 </party>
    <party> Borrower1 </party>
    <party> Borrower2 </party>


Here's what I'm trying to do

    1) loop throw Lender (in-array), and part(out-array)
    2 )loop throw Borrower(in-array), and this is what's not working, party[sizeofLender](out-array)

    Question: How can I put the out-array to append to the last element????
    Is this only possible by only using appendToRecordList
    I don't want to use  this call since this record list is a part of a bigger record, so I can't use the "Record reference property"
    and when those record will change, it will not be updated!

    Thanks

There is a thread about looping issues in this forum named “B2B Gotcha: Looping” that started on Jan 8. You may want to read through that.

Here’s what to do:

loop in-array lender out-array party
map lender record fields to party record fields

loop in-array borrower out-array party2
map borrower record fields to party2 record fields (same structure as party records)

appendToRecordList
toList = party
fromList = party2
fromItem = not assigned

Regarding your last comment: “I don’t want to use this call since this record list is a part of
a bigger record, so I can’t use the “Record reference property” and when those record will change, it will not be updated!”

It is unclear whether or not you want the records within the new list to change or not when the original records change. With the technique above, whether or not this happens depends on how you map lender and borrower records to party records.

A thread in this forum, “B2B Gotcha: Copy by reference vs. copy by value”, also started on Jan 8, discusses this.

If within the loops, you map the fields of the source record to the fields of the target record, and the fields are strings, you will have a copy of the source record. Changes to the target will not affect the target (the entry in the list).

If within the loops, you map an entire source record (or a record that is within the source record) to a record field within the target, then you will not have a copy. Changes to the source records will change the entry in the list.

Use the technique that accomplishes what you need.

Hope this helps.

Rob