How to clear a recordlist

How to clear a recordlist

  
Hello,

Is it possible to remove all the items in a recordlist?

Marthijn
Hi,

To remove all the elements from a record list you have two choices:

1) Iterate over the record list and used the built-in action, ListRemove on each element.

2) A more lazy solution is; simple assign your record list to an empty one (use an action local variable of type record list that you never use).

Hope this can help.

Luis Pista
Your first solution doesnt work: Remove is not a valid operation inside a StartIteration/EndIteration block.


You are right. Sorry for the mistake.
Are there other ways to clear a list, because solution 2 doesnt work too :-(
Hi,

To use solution 2 you need to use an action. It does not work if the empty recordList local variable belongs to a screen.
Thanks, it works now :)
Hi:

Solution 1 also works, but you need to use the Built-in action ListDuplicate, iterate on one and remove from the other.

Cheers:

Miguel
There is another way.

Create an IF with condition List.Empty = False
Point it to ListRemove for the first element (0).
Point the ListRemove back to the IF.

When the list is empty it will continue, but as long as the list is filled, it will stay in the loop.

Be aware of infinite loops with this construction.