Is the final output supposed to be a string ? I think the easiest way would be through a Python node (i.e. loop thourgh the list in the left to create the (‘A’,‘B’) part and then just add to it the initial part by hand).
numbers = IN[0]
result = []
for i in range(len(numbers)):
for j in range(len(numbers[i][1])):
result.append("INSERT INTO tblRevitInstancesMaterials (RevitInstanceID, MaterialID) VALUES ('"+str(numbers[i][0])+"',"+str(numbers[i][1][j])+"')");
OUT = result
range(len(numbers)) gives the length of the overall list @L4 (in my example 2 --> range(2) = [0,1]).
range(len(numbers[i][1])) gives the length of the last layer of sublists. Here, I loop through the entire list @L4, then each sublist @L2 : the [1] part is only here because of the unique structure of the list @L4. Here, the length of the last sublists are 4 and 4.
Yeah sorry, as @Mark.Ackerley said, it was a typo (EDIT : two typos actually). I corrected the script. Please refer to the screenshot of the script, it is correct.
So you are able to use ‘1’ because @ level 2, the item is always at position 1… however you don’t know how many items there might be @ level 4 so you need to use [i] to iterate through them all? I would never have realised that they were in that order…! Thanks!
i refers to the index of the items at @L3, so i must be between 0 and the length of the big list @L4.
Then, we know for sure about the structure of each sublist @L3, so we can use [0] and [1].
Finally, we don’t know how many items there are in each sublist @L2, so j refers to those indexs.
Note that numbers[i][0][j] does not appear in the script, as numbers[i][0] is a int and not a list, so numbers[i][0][j] does not make any sense for Python.