Sort circuits by UV and auto-number them

Hello everyone,

I’m working on a project where I need to sort the circuits by sub-distributors (UV) and generate an automatic numbering of the circuits for each sub-distributor.

Currently, the circuit numbers are being generated for the entire project, but I want to generate them per sub-distributor (UV-x). The circuit numbers should be sorted based on the output of the parameter Element.GetParameterValueByName, so that I have a separate numbering for each UV.

I’m a little unsure as to why you’re creating the dictionary. You’ve correctly grouped the circuits by UV and created each sequence. Now you just need to apply the sequenced values to each element in the group.

1 Like

Thank you for the feedback! I understand your point. My intention is to apply the sequences specifically per UV rather than across the entire project. So the process should be repeated for each UV – meaning the elements should be generated and handled within each UV group individually, not based on all elements in the project. Grouping and sequence creation are working fine so far; the remaining challenge is applying the sequenced values correctly to the corresponding elements within each UV group.

Always pin all node preview bubbles when sharing a screenshot. It allows us to see exactly what’s going on and can also make any issues you might be missing quite obvious.

GroupByKey is giving you the circuits by UV. All you need to do then is create the sequence for each group. You can do this by getting the individual counts of each group rather than the whole list (which is what you’re doing now). Using the right list level (@L2) with List.Count will count the circuits in each group and allow you to create a sequence for each one.