Issue with appendToRecordList used more than once in the loop

I am trying to use 2 appendToRecordLists, one after the other, in the same loop, in order to capture 2 sets of values. However, the problem I am running into is that since the records are not actually appended as entries to the “toList” and there is a reference to the “fromList”, everytime the value changes, and the data gets crossed between the lists. How can I keep the 2 separate and yet get the individual recordlists for the 2 parameters? Your expertise in this area is solicited.

Thanks in advance for all the replies.


Did you try using appendToRecordList as a transformer in a map step instead?

Which version and patch you are using?

Cant we use some temporary variables to hold the data so that both the appendToRecordList steps generate seperate results?

VR is right on with using temp variables, and dropping toList/fromList/fromItem after the call to appendToRecordList.

Keep in mind that lists hold references to objects. That means if you append a record to two lists then you have two lists that reference the same object. Changes to the object will be reflected in all references.

If you want independent records within the two lists, then you need to clone the record and add the clone’s reference to one of the lists.


As a side note:

  1. Create empty, temporary Record List variables before entering the loop using “Set Value…” and providing no inputs. Do not specify an out-array in the LOOP step

Inside the LOOP step, you should follow Rob’s suggestions above.