ListAppend giving error "Duplicate is not a valid operation..." within For Each

ListAppend giving error "Duplicate is not a valid operation..." within For Each

  

I'm trying to get the following to work:

I'm going over a list of records 'ivo', which in it's structure has another list of 'jaargangen'. Then within jaargangen I check a condition and if that condition is met, I want the entire 'ivo' to be appended onto a different list.

I am already using a seperate variable to store the ivo.current, because I've read that appending using .current gives problems. However, I still get an error on my listappend: Duplicate is not a valid operation inside a StartIteration/EndIteration block.

I wouldn't know how to do this differently, since I need to store the ivo that meet the condition in a list either way. I can provide additional information when needed.

It is probably because you are assigning to your new list within the list of jaargangen.

You can introduce a new variable (boolean) called IsFound. Which you set to false at the start of each new IVO iteration.

Then if within your jaargangen iteration the condition you set has matched, you set the IsFound variable to true.

After you are done with your jaargangen iteration (before the closing the current IVO iteration) you check the state of the IsFound variable, if it is true, you append IVO.current to your new list, if it's still false you don't append it.