ListAppend Issue

  
Hi guys!

I came a cross with an issue with ListAppend System Action.
Let's suppose that i need to create 3 RecordList variables with the same data, but 1 of them has one more record that i append with the action above.
Following this:

RecordList1, 2, 3 (RecordList of Text)
GetList.List (Output Structure of Text)

RecordList1 = GetList.List
RecordList2 = GetList.List
RecordList3 = GetList.List
Record3 = "SomeText"
ListAppend to RecordList3


When i make this append, that value is inserted in all recordlists.
There is any reason for this behaviour?

eSpace in attach with the issue and the workaround.


Kind Regards,
Guilherme Jesus
Hi Guilherme,

Record Lists are (in most casses) passed by reference, not by value. As stated in the online help:

 Using the Assign element to assign two record lists, does not create two different record lists. In this situation both variables share the same memory location. If you want to handle two distinct copies of a record list, you should use the ListDuplicate function.


Cheers,

RG
Record lists are assigned in a pass-by-reference manner, so when you do 

RecordList1 = GetList.List you're basically saying that recordlist1 is THE SAME list as GetList.List, not a copy of it (as it would be in pass-by-value).

So this is the expected behavior of the platform. This is documented here.
Thanks for both answers.

Kind Regards,
Guilherme Jesus