When you use ListClear, it is suppose to clear (delete) all items on the list. It works but not when you have a nested list, it will not clear the nested list.
(Users is a record list, with a Items record list)
Thanks for sharing this information. By the way, are you referring to the new client side action?
I'm referring to the server side action (listclear) under the system espace.
Can you explain better? Cause I use List.Clear a lot with nested or nit? And I don't have any issues!
Maybe send your specific problem.Example, OS Version, ...
The issue occurs in a structure record list.
Outsystems platform 10.0.200.0
I'm not able to understand you problem.If you have a list of Users and use the ListClear on it, there won't be any elements on the list anymore. So how are the inner lists relevant? They won't be accessible anymore.
Please provide a sample module that replicates your problem.
Robert Chanphakeo wrote:
Take a look this example and see if i understand your issue.
Here is a real world example
But if the first ListClear removes all GatewaySettings, won't the second ForEach never iterate? The GatewaySettings should have 0 items at that point!
Joao, you would think it works that way but it doesn't that's why I'm reporting this bug.
Gateway credentials (nested record list) never clear and it's a bug! It keeps getting added, listclear is not doing it's job!
I'm 100% certain if you check your listclear method under the hood, you will find that your loop is wrong. Nested record list id not clearing. So when you use Append again it will add to the record with the nested record list from the previous record item.
Listclear simply does not clear nested record list and that's the bug here.
Can you take a screenshot of the properties of your ListAppend node?
Look at my screencast if i understand
In outsystems platform 10.0.200.0, I'm unable to reproduce this issue.
I think you are all right here and i am wrong on this or something was fixed recently.
No problem Robert. Glady you solve your problem. Best Regards
Despite you saying there's not problem anymore, I wanted to understand what you are doing. Most crucially to my lack of understanding is what lists you iterate over in the two foreaches. The ListClear can't clear the list of the first ForEach, as you can't mutate the list you're iterating. So it must be you are clearing a list that's an attribute of the .Current of the iterated list. The second ForEach then must iterate over that attribute, and it must not do anything, since you have just cleared the list.
What I'm puzzled about is your question about a nested list, which seems to imply you're clearing an attribute list that also has a list in its elements, but then the second ForEach loops over a Current that isn't explicitly set...