Array of dictionaries - read value issue

Hello,
the issue I encounter is more in my head but I don’t get it right.
I have an Array of dictionaries which I populate.
Later on I want to populate a popupMenu and I tried this:

> for each position as Dictionary in app.allPositions
>   pm_paymentName.AddRow(position.Value("paymentName"))
> next

The result is that the popupMenu is populated with the same value (last value of the dictionarry in the array).
Of course I am missing a “new” to get a fresh dictionary each time but I can’f figure out where to put it.

for each position as new Dictionary in app.allPositions
pm_paymentName.AddRow(position.Value("paymentName"))
next

Throws a Syntax Error.
Where am I wrong?

Thanks in advance!
Thomas

That code is 100% correct.

Seems like the problem is in creating/populating the array of dictionaries, not reading the array to populate the popupMenu.

Hello Jeremie and thanks.
This is a point of view I did not consider. Since that part of code did not throw errors I was considering it as fine. But maybe it work but differently from what I expect :slight_smile:

Will check that.

Couldn’t wait and looked at it immediately.
@Jeremie_L you were right. A “new” at the right place does miracles :smiley: