# Create sublist over multiple sublists

**URL:** <https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141>\
**Category:** Lists-Logic\
**Created:** [June 13, 2019, 10:24pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141 "2019-06-13T22:24:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![blou](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@blou](https://forum.dynamobim.com/u/blou)\
**Post date:** [June 13, 2019, 10:24pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/1 "2019-06-13T22:24:22Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/497a42b37e402f12f1d65779e8f0ec0e5b157650.jpeg)  
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?

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [June 13, 2019, 11:30pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/2 "2019-06-13T23:30:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AmolShah](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/amolshah/32/103244_2.png) [@AmolShah](https://forum.dynamobim.com/u/AmolShah)\
**Post date:** [June 13, 2019, 11:31pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/3 "2019-06-13T23:31:53Z")

</div>

Hope this helps!

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/d/6d7e09a1a5b0a84caa0407c1b9f14dae8ae0109f.png)

---

<div class="post-metadata">

**Author:** ![stillgotme](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@stillgotme](https://forum.dynamobim.com/u/stillgotme)\
**Post date:** [June 14, 2019, 5:56am UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/4 "2019-06-14T05:56:52Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/6/26dbea0f184f9da7cc2aca52c5b31e582cf5a326.png)  
i believe you need something like this right?

---

<div class="post-metadata">

**Author:** ![blou](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@blou](https://forum.dynamobim.com/u/blou)\
**Post date:** [June 14, 2019, 3:50pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/5 "2019-06-14T15:50:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gduncan74](https://avatars.discourse-cdn.com/v4/letter/g/f9ae1b/32.png) [@gduncan74](https://forum.dynamobim.com/u/gduncan74)\
**Post date:** [June 14, 2019, 7:18pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/6 "2019-06-14T19:18:37Z")

</div>

How about this?

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/7/e7a0235b49fb8c94e3d23984fcf76ccfb815687d.jpeg)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [June 14, 2019, 8:45pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/7 "2019-06-14T20:45:55Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/d/fd29617ea35b78c2f97da99e2c460149f85d883b.png)

---

<div class="post-metadata">

**Author:** ![blou](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@blou](https://forum.dynamobim.com/u/blou)\
**Post date:** [June 15, 2019, 1:49pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/8 "2019-06-15T13:49:11Z")

</div>

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:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/c/6c234d0a7a3b6a284e84f0f8b7f8a805c085be33.jpeg)

---

<div class="post-metadata">

**Author:** ![gduncan74](https://avatars.discourse-cdn.com/v4/letter/g/f9ae1b/32.png) [@gduncan74](https://forum.dynamobim.com/u/gduncan74)\
**Post date:** [June 15, 2019, 7:58pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/9 "2019-06-15T19:58:57Z")

</div>

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

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/1/81aa03c9efe970eb7bf8d52ea090b13c34350794.jpeg)

---

<div class="post-metadata">

**Author:** ![blou](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@blou](https://forum.dynamobim.com/u/blou)\
**Post date:** [June 16, 2019, 7:59pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/10 "2019-06-16T19:59:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![stillgotme](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@stillgotme](https://forum.dynamobim.com/u/stillgotme)\
**Post date:** [June 19, 2019, 9:44am UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/11 "2019-06-19T09:44:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [June 19, 2019, 1:05pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/12 "2019-06-19T13:05:18Z")

</div>

Is that not what I posted?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/5/4596cadd58b64313394c0b03c53e7ffced54554a.png)  
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.

---

<div class="post-metadata">

**Author:** ![blou](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@blou](https://forum.dynamobim.com/u/blou)\
**Post date:** [June 20, 2019, 8:40pm UTC](https://forum.dynamobim.com/t/create-sublist-over-multiple-sublists/37141/13 "2019-06-20T20:40:24Z")

</div>

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).
