Different Indices in Sublists - How to Extract Data from a Specific Index

Hi there,

I am having a problem after creating a user interface to prompt user input for a list of answers - in simple words, the user selects factors for calculation based on wall types on each level (external, internal). If there isn’t so many wall types on that level, the script is skipped and the output of the list shows only “set toggle to true”. It is a rather simple user interface with three iterations per level (I’m not very pro at this so I made it simple). When I want to obtain data for index 1 in all the sublists, the node turns yellow as there are no index 1 in some of the sublists. Could I ask for advice on the best way to get the values for index 1?

image

I also tried the try and except on python script, but I’m not very sure how I should write the codes to get what I want… Hope to receive some help here, thank you!

I hink the issue is, some subsists don’t have the index 1 (your sublist (iii), for example), this will return a null value.

Get only the sublists whose number of items is greater than 1 and then use the List.GetItemAtIndex.

Example:

1 Like