Hello,
I know this has been asked ad nauseam, but I spent two days on this single problem, and I just cannot crack this nut.
Please see screen shot. I need to organize a list of sheets by some parameter value, but I cannot make the final list look the way I need. Namely, the title of the groups should be right before a list of the sheets that they contain.
I tried all combination of levels, in the “AddItemToFront” nodes… nothing is working for some reason. This is the closest I was able to make the list.
Thank you.
one way to patch it downstream:
1 Like
The first question would be what are you trying to accomplish with this list structure? What’s the reason for having a group title and a sheet list in the same structure and why would the sheet list be at a different level?
To fix it, we need to look at the node you’re using and it’s expected list structure. List.AddItemToFront
adds a singular “item” to a given “list” (item and list here can have additional levels, but the insertion method treats them as a singular object and a list of objects respectively - that’s important). This maintains the list structure of the given list by inserting the item at the 0 index. If you want the list of sheets to be one level below the title, then you don’t actually want to insert the title into that list - you want to insert that title into a list containing the sheet list as a sublist. Another way of saying that is that you want to treat the whole (sub)list of sheets as a singular item when joining with the title. The easiest way to do that is to invert your method and use List.AddItemToEnd
and add each sublist of sheets to each sublist of titles.