Maniputaling current and current row number in lists TraditionalWeb
Application Type
Traditional Web

So i was developing something and notice that, when i click an action inside a line of a table record, some strange behavior was happening. Instead of changing the line i clicked, it would change the last one.

I know why it is happening, so basicaly i have a list filter that use that same list to get some result, and in the debug the moment the list filter is executed the current  from the tablerecord change to the last record. All good until here since, I can use current row number and list[currentrownumber] to fix this but i was trying to manipulate the list.current.

i did a couple of tests with Assign to another variable of same data type, append all from the first list to the second and list duplicate.

In all the previous cases when any of the isntructions is executed, the current from the previous list change to the last record.

This is not an issue, i just want someone with a more deep knowledge about how all this actions works, to explain me why the list filter, list duplicate, list append all and assign variable would change the current of the main list.


Thanks

Hi Carlos,

can you reproduce it in a sample? so we can check what is happening?


Regards,

Luis

Here it is, don't know if you can publish this, but the point here is in the debug.


can also run here.

https://carlosdiogo.outsystemscloud.com/Test/Employees.aspx

Test.oml

Hi Carlos,

both current and currentrownumber are pointers to whatever some part of the software has left it on.  So an event in the ui will set it to the row the event happened in, an aggregate or sql will return it with current being 0, and looping over it will start it on 0 and move it forward to the end.  

So my guess would be that actions such as ListFilter or ListAppendAll are implemented as looping over the original list, and so just like a ForEach, after they are done, the current and currentrownumber are pointing to the last item in the list.

What doesn't make sense to me, is that you say you can still use currentrownumber ??  Do you copy the value of that before you do the ListFilter.  As far as I can tell, after a loop, it also points to last record.    EDIT : just saw your test.oml, so now I understand, you have the input variable of your action to remember what the currentrownumber was.

Dorine

Ya but even teh assign of variables will mess the current row. that's what is strange to me :S 


so i have list A with current 1 and i say list B = list A and then i do a loop on list B it should not mess up the current on list A.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.