Problem with Records in a Record List changing without action on my part

Problem with Records in a Record List changing without action on my part

  
To setup this problem, I have a Record List containing Records with a number of attributes, one of them being of datatype Time. I want to reduce this Record List to only the unique Time values. Here is the partial state of the Record List before sorting:


Now I sort the Record List and it looks like this:


You can see that the Record List is sorted and that the current pointer has not changed. Thats alright that the current pointer hasn't changed. I suppose there are different philosophies on what to do with the current pointer.

My Next step is to clear a second Record List that I intend to fill with the unique Time values. My loop is going to look like this: Assign Time value to a temporary Record, For each on the first Record List, if Time value is different then Append temporary Record to the second Record List, if not different then keep looping, when done with loop append the last Record.

The problem with this is that when I execute the first step in this process, "Assign Time value to a temporary Record", which looks like this:


The record in the [0] spot of the first Record List is being modified to the Record in current. Notice the Id value of current and [0]:


This confuses me. Why would [0] be modified at all? I can't imagine this is supposed to be happening. I can try and find a way to work around this but I think this is a bug. Has anyone ever seen this? Does anyone have any suggestions?
All I see is the debugger-window, so I have no idea what you are really trying to do.

first of all:
1. the debugger window is not always what you see is what you get.
2. Post you oml which makes easier to understand what you are trying to achieve.

and the biggest question from me is.. what is your actual problem?
do you see a bug in the debugger window, or is the actual result incorrect?
Make sure your list isn't being modified by another action.  If you are passing the list into another method, values can be modified even if you don't pass anything back.
I'm afraid I can't post the oml. I'll try to create a separate eSpace when I can find the time so that this issue is isolated.

I understand that the debugger isn't always accurate, however, in this case it is. I'm simply printing to the screen exactly what I get in this loop after I perform the loop and the data in the debugger is exactly what is on my screen. 

As for the actual problem, let me try to explain it like this. I have a list that looks like this, [5,3,5,2,1,1,5], and I want to sort it and find the unique values so that I get this, [1,2,3,5]. The problem appear to be that, after sorting, the current pointer does not change (again I'm not saying this is an error, its just related to the problem), and when I try to assign the value of some temporary variable to be array[0] both the temporary variable and array[0] somehow get assigned the value of the current pointer (this is the problem). This in effect makes my example array look like [5,1,2,3,5] after I've finished my process.

I've already avoided this issue by simply looping in a different way. There are a couple of ways to do this and its just this one way presents a bug. 

There are no outside actions being called here. Everything that is done is listed here.
Hi Philip,

How are you doing the sorting?
There is a pattern that causes problems, when users use the .Current as a temporary record to do stuff like ListAppend(list, list.Current).

Also .Current should never be used for anything outside iterations (unless the list only have 0/1 elements).

Regards,
João Rosado
Bump

Hi again Philip,
I'm still interested in knowing how you are doing the sort of the recordlist. If doing it manually on the eSpace or by the use of some extension.

Regards,
João Rosado