Strange behaviour - Assigning an empty value to a record list

Strange behaviour - Assigning an empty value to a record list

  
In the end of a cycle I need a record list (RL) to become empty. To achieve this I assign it the value of an empty RL.




___________________________________________________________________________________________________________________________
After the first few cycles everything seems fine, but on some of them, this happens:
  1. The RL which is supposed to be assigned an empty value is NOT empty
  2. The RL which should always be empty is not empty anymore



___________________________________________________________________________________________________________________________

After a few cycles the empty RL looks like this:


___________________________________________________________________________________________________________________________

That variable assignment is the only one acting on the empty RL:

___________________________________________________________________________________________________________________________

What is going on? I can't seem to understand this.

Thank you so much,
Cristóvão Vaz
Hi Cristovão,

Search in your code if in some place you are populate the Num_Criador_RL_Empty, because maybe this could be your problem.
Otherwise why don't you use the Action System "List Clear" instead of the Assign?
It should resolve your problem.

Best Regards,
Diogo Miguel
Hi Cristóvão,

You'll need to duplicate the empty list to generate a new empty list.
In your example you are just switching the pointer to the same empty list (that will not be empty at the end of the second iteration).


Hélio

Hello Cristóvão,

That behavior occurs because the object Record List is passed by reference.
Do do what you need you can use the System action "
ListClear".

Best Regards,
Gonçalo Martins
After your answers it seems obvious. Thank you everyone