ListAppend is populating 2 variables at the same time!

Hi peeps!

I don't know what's happening... I have 2 RecordList variables exactly the same


In my loop, when I append a DetailR (record) to the list DetailRL (list), it's popullating DetailRLEmpty as well!
And it changes indeed, it's not only in the debug view - that I saw in other posts that it can differ.

See attached the debug, where both variables change!

How come?
Hi Carolina, Somewhere on your code you have an assign using both recordlists ...probably on some init var Logic.... Recordlists works by reference and if in some point they was assigned with each other they will have the same values. Regards, Rafael Pereira
Yes I was assigning the Empty to make it empty...
but at the end I found out that I was using too many variables.

OrderDetails are within OrderHeader, so no need to have the RecordList DetailsRL neither the empty one.
I append the record to directly to the list
And when I restart the loop, I remove the items (ListRemove) within the list to make it empty. This is more safe.

Now it's working, thank you!

btw I like your profile picture! Where are you from in Brazil? I'm from São Paulo. :D
Hi Carolina,

Rafael responded correctly.

However, if you want to clear the list, instead of using the ListRemove 1 by 1, try using the ListDuplicate action, based on the empty list, and assigning the result to the list you want to clear. That should work as well, and seems to be better performance-wise :)


Paulo Tavares
I'll check the ListDuplicate approach as well.
Thank you!!
In my first example they were not assigned to eachother... I did the append of a single record into one of the recordlist and this record was appended in both lists.
but ok, now I understand.