Nested foreach metadata question

   1842   1   0
User Avatar
Member
44 posts
Joined: April 2017
Offline
Hi! There is some issue I can not solve for a very long time.

I have nested foreach loop, looking like that:



First one is set to "fetch piece or point", second is set to "Fetch input"

First one gets geometry, and loops it 4 times, using 'name' attribute, basically looping groups
Second one loops that given group, point by point, and runs pathfinder.

And there I have this 'attribwrabgle10" node with the code:

@myit = detail(1, "iteration");

The result I get is:


Basically, only the last iteration number of the 1st loop gets assigned to the "myit", 200, 249,500 and 1790 based on number of points in each group.

While I expected "myint" to be 0,1,2,3,4,5,6,7,8.... 2739 (1790 + 500 + 200 + 249)

Why is it working like that? How to make sure, that second foreach iteration puts actual iteration number to the wrangle variable?

Attachments:
nestedloop.png (50.2 KB)
resulkt.png (11.6 KB)

User Avatar
Member
8551 posts
Joined: July 2007
Online
assignators
second is set to "Fetch input"
which means it will fetch input every iteration, so doesn't matter what the previous was, the last one is computed from the input with no recollection of previous ones, that's why you have just last one

if you want result of previous iteration to be fed in for next you probably want to set it to "Fetch Feedback"

also the fact that all the points within the group have the last iteration number suggest that your attribwrangle10 runs over the whole group rather than the single point which you expect to be populated with iteration value, if that's the case then even in true feedback mode the last iteration would overwrite i@myit of all the points in the group with the last iteration value

since find shortest path is able to run with multiple start or end points without any loop I'm wondering why you have a need to loop per point separately, but you probably have a reason
Tomas Slancik
FX Supervisor
Method Studios, NY
  • Quick Links