Custom node for applying function to next item on list

Dear dynamo users and professionals,
what I’m looking for is a node with which for every “Run” I’m pressing it will move an item to the next location point. My problem is regarding acquiring this every “next” point with every “Run” I’m pressing.
So what I did is create a Custom node (Img 1)in which we get the list and the index number as inputs, the node gets the item and increases the index number by one, which is also provided as output. Outside the node (Img 2) I am re feeding the increased index number to the Custom node again so it gets the next point fro the list. The way I structured it is a cyclic dependency but how is it possible to create it otherwise? The WhileLoop doesn’t seem to be working either (Img 3).
I know I’m missing something crucial here but sorting out this properly, will assist me a lot in many future tasks.


I don’t think you will get one result each time you rum a graph because dynamo is programmed to run the entire script at once and even if you manage to run first item alone the graph will stop after the run and you have to manually change the inputs and re-run.
Alternatively,how about having a number slider that can move the element as you slide. the downside would be that you can expect the same result using a UI as most of them reads the information after it is submitted.

What I need is a graph that by pressing “Run” the element proceeds one step forward and by repressing “Run” the element proceeds one step further. It is hard for me to consider that this is not possible, maybe I am far from figuring out the way. The slider is not something I am willing to perform because I will have to make it more complicated in the future and the slider would constrain me a lot. What I am thinking is that maybe the element proceeds one position by altering (through Dynamo) a Revit parameter and then, the element proceeds a step further, by acquiring and re-altering the previous parameter. Please save me some time if you think that this is the wrong direction.