Strange behaviour of Keep in ForEach

Hey,
I encountered some behaviour while patching that I don’t quite understand.
When changing the condition for Keep inside a ForEach loop it somehow seems “to reset its state”.
Also some conditions seem not to return the correct slice count.
Idk if this is a bug or I am just too slow.
Any insights appreciated.

Keep.7z (20.3 KB)

Ah yes, well if you disconnect the pin, it will feed false to it → the slices (including their state) will be removed from the loop. Ìn your case that means that all the instances of GetJpgInfo get kicked out. So when you then re-connect it and the condition turns true again, those states will be created from scratch (new GetJpgInfo) → you’ll need to trigger the read once more.

image

this for some reason doesn’t read all jpgs here

@Elias if i do that, it’s correct count:
image

Sorry not quite sure what you mean / what you expect. Maybe I misunderstood what to look for in the patch?

Ok, I thought Keep only affects the output spread(s).

Does this also “cause the issue” with the output spread count? Compare the count of the left ForEach set to < 30 with the one on the right that has the same condition.

That would probably be a better definition of how it should behave. Always aligning the slice states to the input. I guess we’ll need to think on it.

@Elias i literally mean this, but it’ seems the GetJpgInfo

KeepStrange
KeepStrange

Yes, thanks! After looking at it again I agree, the behavior is not really explainable due to the Keep pin influencing the slice states. I really do like Björn’s suggestion, not sure why it wasn’t done like that in the first place. Maybe there was a reason. We’ll report back on this.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.