List.Indexof with repeating items in list

I am writing a script to auto import pipe HGL information from EPA SWMM.

The only remaining issue I have is getting List.IndexOf to make a sub list if there is a repeating string. I.e. I need line 79 to have a sub list with line 15 and 16 included. Any ideas? I messed around with levels and lacing but could not figure it our. Thanks!

Here is the element if that helps:

Do you really need sub lists?

Maybe List.GroupByKey can work?

Enumerate the list and then group by key

I was thinking how i would do it before Mike’s suggestion.

This is what i came up with.

.

Also just FYI.

https://forum.dynamobim.com/search?q=flatten%20sublist%20by%20value
https://forum.dynamobim.com/search?q=create%20sublist%20from%20value

Collating singletons isn’t necessarily the way to go, either process in a continuous one by one method or expect a list with one to many objects. If you only need to change a type parameter reduce your objects to unique types before processing. Here’s the shortest one I could figure

1 Like