My prims have a ID attribute. I also have a uniqueIDs detail attribute which is an array of all unique values of @ID. I'm trying to create a group which will contain a single primitive of each unique @ID value.
In a 'for each prim' loop, I use the following vex in a prim wrangle:
which would find the first primitive of the same ID and if it's the same as current it'd be groupped if you also want the detail attrib with all those prims you can do detail wrangle afterwards
what makes it not work for your approach is using for loop to iterate over primitives which creates several issues - foreach loop in that mode merges individuals polygons in the end, which makes merging Detail attributes ambiguous and only one will be taken you'd have to run over your whole geo in Feedback mode and limit your wrangle on only for a single prim based on iteration to get expected result, but that'd be way overcomplicated way to achieve what Wrangle does by default
- additionally foreach loop over primitives will split your geo into individual prims, which may change it's topology if they were fused before and may not be desirable