Nested iterations on objects

Hi guys. I am trying to update an object in the first iteration with values from the second iteration as shown in the image below:


I have added a few debugging details in the log that indicates that the first iteration and the second one is both correct. However, when i try to update the “Parent” object in the selection which is done in the first iteration, it seems like its updating from the object also in the first iteration. I might be approaching this from the wrong direction, but how can I make sure its updating from the correct iteration?
Or is there a better way to do this?
Please advice on how to proceed.

Øystein

Hi!

I don’t think it will work to iterate the same datasource in a double Foreach. Reason: it will then need 2 contexts / have 2 objects in context in the inner loop. Not sure which context it uses, but it makes sense to me that it does not work.

Suggestion: use two different data sources for the two iteration levels!

Hi Kristian and thank you for the response. I made a secondary collection of the same objects, and now it works :slight_smile:
Øystein

1 Like