Creating a number sequence for each index of a list?


I’m producing a script for populating the door mark parameter in various ways depending on the type of door in a project. I’d like some items we’re scheduling with the doors, such as notice boards and lift doors, to be scheduled as “text parameter” “00n” with n being an increasing number. I want the 00n sequence to start again for each type of element for example: Lift doors 001, Lift doors 002. Notice Board 001, Notice board 002, Notice Board 003.

At the moment I’ve managed to list them all consecutively: Lift doors 001, Lift doors 002, Notice Board 003 etc. but don’t know how to restart the sequence for each type. I’ve created a list with each type at a different index number but I don’t want to split it via specific index number because different projects could have different numbers of types. I’ve attached an image which hopefully clarifies this a little.

Thanks in advance,


string pad



Thanks for the help so far, that has simplified the approach I was taking to generate the names. I’ve attached an image showing how this applies to my project, I’d like to be able to now produce names with the format: Notice Board 001 , Notice Board 002, Lift Doors 001. So the sequence restarts when the type of element changes.

Many thanks for your help so far,

list split query 2



Combine List.GroupByKey with this


Maybe this:


That’s great thanks! Would you mind explaining that first Code Block for future reference?

Have a look here under “How about lacing”:


Why doesn’t it work for me? @jostein_olsen

I get either
Warning: The value in a ranged expression must be number or a letter.
Warning: There is no version of Get.ValueAtIndex that accepts argument type(s) (function, string[]).

Take another look at the example

[… ] != (…)

This 1…List.Count(x); was the solution for me, but thanks!