Variables in Code Blocks Not Working

Hi all,


I’m trying to create a code block that selects every third element out of a sublist. I’ve been trying to do this using a code block with variables for the index and the total number of items in the list, but for some reason when I use a variable in a sequence for an index, it returns a value of null (see photo). What am I doing wrong?


You’ll need to use ‘List.Map’ or define a function to access elements in sub lists

Refer to this thread, not sure, may be similar to what you need. It extracts the sixth element of every sublist


Vikram Subbaiah

Hello Bo Steadman,

Please look at attached graph. (I have added dyn file as well. GetItemFromSublist)

Is this what you are looking for?




Thanks for your replies. What you were suggesting, Ritesh, is slightly different (I was looking to do every third element) but it guided me to what I was hoping to do. And now I understand how the List.Map functions works! This is what the script I used looks like:



Hi Bo, we have an out-standing bug that variables don’t work in anything but the last bracket when accessing a list item in a code block. I will add this issue to the tracking there.

Thanks Colin. That’s good to know.