Unique numbering based on given value

Hi Dynamo users,

I currently have a list with 2 random values placed on different indexes, BPL and CG.
Each value should get an continuing numbering like -001, -002, -003…
i’m able to count the unique value’s and number them. But i can’t see a solution to bring those numbers back to the original list.

The green group should be the end result. The list within the node + is how far i have come.

Thanks in advance,


Hi Sven, you could get the indices for each unique item using the node List.AllIndicesOf attached to your “UniqueElements” output. Then use those indices in combination with the List.GetItemAtIndex after your + Node. (also flatten your + Node first)

PS: If you don’t understand what i mean, could you share this dynamo file?

hi @Sven_de_leau,

can you share your dynamo and a sample revit file?

Here is a python solution. See if this works for you.

CountingUniqueItems.dyn (7.4 KB)

Track and use the original indices to restore the sort order

nmbrSeq.dyn (23.0 KB)

1 Like

I think in the python solution I missed the number formatting. I have added the Dynamo OOTB nodes solutions. I saw @Vikram_Subbaiah added another solution as well.

CountingUniqueItems.dyn (26.1 KB)

1 Like

Thanks! @Vikram_Subbaiah @rab_i

Both the python and dynamo script seem to work.

1 Like