Element ID is the same

I wrote a dynamo script to copy the AREA of a filled region and paste it into comments (so we can tag the area of a filled region).

It works great, except if more than one filled region has the same AREA it ignores it and does not copy the value into the comments.

Looking at script it seems like the ElementIDs get changed near the end of my script and are the same value for filled regions that are the same AREA. I highlighted in my image.

Any suggestions as to why this is happening? I’m new to Dynamo…

Thanks!

You’re only getting the first element as a result of the list.firstindexof node. Try using a List.GroupByKey node and a flatten node instead.

List.GroupByKey node fixed it! Thank you very much for the help. I learned a lot with this one!