A routine that takes one item at the time, out of a list of items

I would like to create a routine that (when executed from the Dynamo player), takes one item out of a list of items, each time I run it.

For example, the first run, takes the first item, the second run takes the second item, and so on.

I really wanna do something with this item, but that’s not an issue for now, what I’m having trouble with is taking the items step by step.


So the problem you have, is that each run of the player is ‘stand alone’ it isn’t logging what the previous run did.

  • You could have a user manually input a start number?

  • Or you could automate that, by having each run read a .txt. file, containing a number starting at 0 and overwrite the file each time with n+1? (up to a defined maximum amount).

Alternatively, perhaps you could run all the sessions in a single graph, but have a pop-up for users which breaks it up through the run? It is hard to know without some more context…

I hope that helps,


1 Like

Hi there Mark

Thanks a lot, what you propose actually solve the problem, I personally like the 2nd solution, by the .txt file. That gave me an idea I can develop.

Although, I think the last choice it’s my favorite, how do I do in order to develop a pop-up through the run?
Is it by using an “If” node?

Thanks again,

1 Like


The package Data-Shapes lets you build simple interfaces, you can also code simple pop-ups using Python, but I haven’t done that in a while :slight_smile:

Hope that helps,


1 Like

If you want a simpler way to do it one by one, and if your “items” are Revit elements, you could use a parameter. Take your list of elements, filter by Parameter equals 1, take the top item. At the end of the script, Set your Parameter of that top item to 1. When you run the script again, it will take the next top item because the previous will be filtered out.

You can also make a “reset” script that will set all the parameters to 0 again.