Get item at index from list count

Hello guys.
I am working with a data set which is imported from excel.
The data itself contains 9 rows of information that I am collecting my data from with the Get.ItemAtIndex.

So here I have 9 rows of data, and for each input I have to do the #9 so it does the collecting 9 times.
But sometimes the data is 8,10,11,12 rows etc. So I thought I could use the list-count that automatically gets the number “9” and use as an input so the Dynamo Script is more automated than that the user has to change the number according to how many rows it is.

list sorting

Anybody got an idea?
Regards, Joakim

Hi @joakim.k97 ,

Is the number of columns for each row a fixed number ? or does it vary for each row ?

It is the same, so the 0 and 8 in the code block is always their regardless of what is “#” is. (425 Bytes)

Just open it with any text editor and copy it to a Python script node

Does this serves the purpose ?

Thank you, I will try.
Should the “OUT” from the Python Scrip then be used as input for the “index” ast “List.GetItemAtIndex”?

All items will be collected.
for each row it will visit each column.You don’t have to use List.GetItemAtIndex.

Yeah I see what you mean.
But what I want to do is to start at 0, get that item, go 8 steps and collect that item, and then do that 9 times.
Becuase now your code, just does exactly what the List.Flatten does, the output is the same.

So you just want to collect the 9th item , index 8 , only for each row ? right ?

Is it always the last item ?

Maybe I explained myself wrong.
I want to collect the item at “0”, then go 8 steps in the list and collect the next item, and then do that 9 times.
So the output in the new list would be 0,8th,16th,24th,32th item etc.

I think I got it.
I hope this one works rightfully .

IN[0] dataList
IN[1] step
IN[2] repeatTimes (241 Bytes)

Thank you Mohammad.
That works good and now gives me the indexes 0,8,16 etc automatically from that list.

Then I want to expand it so I also can get 1,9,17 etc into a new list.
I guess the script then just have to be modified with a “+1” to work then.

You are welcome ! I am so glad that it worked

Here is this one , you can shift starting index to start at any index.

To start at index 1 shiftBy=1. to start at index 2 shiftBy =2 , and so on.

dataList= IN[0]
shiftBy=IN[3] (266 Bytes)

Thank you very Much again, I had the idea that it should have been something like that. My Python skills are not so good but I am trying to learn.
I wish you a happy easter and a nice weekend!

1 Like

You are most welcome. :relaxed: :relaxed:

I wish you all the best.

1 Like