How to I reorder a list of elements by ID given a list of numbers that represents the Element ID?

I have a list of numbers that represent Element ID (not in numerical order). Would like to have another list that have these Element ID match the order of the first list. Is this possible or am I just confusing everyone.
List 1 is the list of element id numbers and the order I would like them to be in. The second list is a list of pipe I am trying to reorder.

Perhaps get element by ID?

2 Likes

Hi @jtmiller ,

An approach like this should work, assume the numbers are the IDs for now:


PS: You could also create a dictionary where the key is the ID and the Value is the Element, but this works too.

Thanks, would like more of an explanation of your Graph because I couldn’t figure out how to use it in mine. Also, I played around with dictionary, but could not figure out where to begin or build one. I did figure out another solution to my problem. Listing in below.

I figured out a work around to my problem overall if anyone is interested.