# Create sublist over multiple sublists

Hi,

I feel like I’m stuck at a very simple problem but cannot move forward untill this one is solved and therefore I need a little help.

I have one list of elements grouped/chopped in two ways:

With these two lists I try to reconstruct the ‘desired output’.
What the final list is telling me is that i have 6 elements in a project, 3 elements on the first floorlevel and 3 elements on the 2nd floor. On the first floor there is a group of 1 and a group of 2 elements, on the second floor the same but in another order.

Any ideas how to do this?

Try changing the List Level (play arrow) on the second chop for the input list.

Hope this helps!

i believe you need something like this right?

Thnx all for the answers, @SeanP to my knowledge I tried every combination of list level but it didn’t work.

The other solutions do not work in my case, because I need to work with the given information as an input i.e. I need to create the result with only the inputs given: List(1…6…1), list{3,3}, list{1,2,2,1}.

What i actually need for the List.Chop to do is to chop the list as if there where no sublists, but in the output I need the (sub)sublists again back.

Good solutions both, but I cannot recreate the given inputs automatically so it is useless if my input changes.

I’d see if there’s a better way to get your inputs, but it is possible. You can’t ask Dynamo to guess at your logic.

Thnx again for the answers, they work with the simple example, but not if I make it a little bit more difficult. Luckily I managed to solve it wihout using Python, because that is a bridge to far right now for me.
This is my solution:

Not sure why my simple graph doesn’t work for you.

Because it gives not the desired output. I need the first 3 elements (not groups) in one subsublist (this equals the first 2 groups), then the next 3 elements in one subsublist (equals 1 group) and finally 4 elements in one subsublist. This equals the last 4 groups.

The simple solution with only the list.chops puts the first 3 groups into one subsublist.

well i believe the purpose of doing this is the group elements together based on their type and property right. so using groupbykey are still the easiest way around.

Is that not what I posted?

Your only issue is that your second set of list lengths does not have the right list structure. Once you get that it’s pretty straight forward.

The list is not grouped by type and property, but by distance so they do not share a key together.

Yes Nick, your graph helped a lot in my solution. But it didnt work out as you can see in the 2 List (here i am expecting the numbers 7 and 8 grouped under [0] List).