# Reduce levels of list

**URL:** <https://forum.dynamobim.com/t/reduce-levels-of-list/21514>\
**Category:** Developers\
**Tags:** python, dynamo\
**Created:** [May 1, 2018, 4:13am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514 "2018-05-01T04:13:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [May 1, 2018, 4:13am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/1 "2018-05-01T04:13:59Z")

</div>

Hi There

Here there is a 1 main list (As shown in blue circle) in which there are 18 lists (As shown in red circle). There are 6 lists (As shown in green circle) in each of 18 sub lists.

Now here in output i want directly those 6 lists & eliminate those 18 lists.

0 List-Main List  
0 List - Sub List  
0 Surface  
1 Surface  
2 Surface  
3 Surface  
4 Surface  
5 Surface  
1 List - SubList  
0 Surface  
1 Surface  
2 Surface  
3 Surface  
4 Surface  
5 Surface

![103](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/3X/3/6/36642c83291f316675d4cf81284fd1d152bc501c.JPG)

---

<div class="post-metadata">

**Author:** ![PauLtus](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paultus/32/48502_2.png) [@PauLtus](https://forum.dynamobim.com/u/PauLtus)\
**Post date:** [May 1, 2018, 5:58am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/2 "2018-05-01T05:58:05Z")

</div>

I’m not exactly sure on what basis you do or don’t want those lists but couldn’t `List.GetItemAtIndex` do the job?

---

<div class="post-metadata">

**Author:** ![Scott\_Crichton](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/scott_crichton/32/8876_2.png) [@Scott\_Crichton](https://forum.dynamobim.com/u/Scott_Crichton)\
**Post date:** [May 1, 2018, 6:09am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/3 "2018-05-01T06:09:31Z")

</div>

If you are just after the list of surfaces then using the “Use Levels” in the node downstream would give you that access?  
Or use the List.GetItemAtIndex as @PauLtus suggested.

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [May 1, 2018, 6:23am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/4 "2018-05-01T06:23:08Z")

</div>

Hi Guys thanks for response.

I will clarify what i want & what am i getting right now.

As shown in blue circle there are 2 main list 0 & 1 containing 19 & 16 sublists respectively.

Now when i go for surface 1 output, i get all 35 surfaces in single list as shown in circle green, but i want separate list of surfaces for separate main lists as it is shown in red circle.

Please note here data shown in red circle is just for example to explain what i am looking for.

 ![104](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/b/5b8d1885107898c96aee7a550a05a63cd8db55f8.JPG)

---

<div class="post-metadata">

**Author:** ![til.shviger](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/til.shviger/32/36048_2.png) [@til.shviger](https://forum.dynamobim.com/u/til.shviger)\
**Post date:** [May 1, 2018, 6:42am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/5 "2018-05-01T06:42:04Z")

</div>

I could be wrong

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

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [May 1, 2018, 6:49am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/6 "2018-05-01T06:49:39Z")

</div>

What is suggested should very well do the job, just make sure to ask for the right list at the right level.  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/5/654da5f5c87587e465a627b65abd82fbcff3770c.jpg)

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [May 1, 2018, 8:41am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/7 "2018-05-01T08:41:21Z")

</div>

Hi Guys

Thanks for suggestions. But here as per your suggestions i am getting all surfaces of all lists whereas i am looking to get specific surface of all lists. Please see example in green circle. Here i am trying to get surface 1 of all sub-lists.

Also note i want surface 1 main list wise, under main list 0, surface 1 of all 18 sub list & under main list 1, surface 1 of all 16 sub-lists.

 ![105](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/e/be4efc58ad46ff65d1bd0af2fc0867fb12e86ac0.JPG)

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [May 1, 2018, 8:54am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/8 "2018-05-01T08:54:59Z")

</div>

I’m still not sure what exact list you want to extract but have a look here:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/e/7e8b6c9ed94f8edb117dca89af627423d7d62192.png)

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [May 1, 2018, 9:16am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/9 "2018-05-01T09:16:26Z")

</div>

Hi Jonathan

Thanks mate…i almost got what i want. Only a little change i want is i want separate list wise output as shown in green circle. Here output is same as per your suggestion (Shown in red circle) just it is separated list wise.

 ![106](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/c/3c1d420979281e49de84f50ecce8afd08d2cd5bb.JPG)

Again Manny thanks…cheers…!

---

<div class="post-metadata">

**Author:** ![Jonathan.Olesen](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jonathan.olesen/32/44242_2.png) [@Jonathan.Olesen](https://forum.dynamobim.com/u/Jonathan.Olesen)\
**Post date:** [May 1, 2018, 9:24am UTC](https://forum.dynamobim.com/t/reduce-levels-of-list/21514/10 "2018-05-01T09:24:12Z")

</div>

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/1/e12e2ec21b9fd56a69316b7709195749eb33ade5.png)  
I realize now this input is what you have originally… Think there is some minor changes from 1.3 to 2.0 (i’m on 1.3). You could use a “list.Chop” with length 1 after your get your items at index? 🙂  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/6/16248e54faf6c3d75502d0ba2334e65e2446ad3e.png)
