# Filter Sublists by conditions

**URL:** <https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700>\
**Category:** Lists-Logic\
**Tags:** excel, dynamo, list-filter\
**Created:** [November 21, 2017, 11:46am UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700 "2017-11-21T11:46:40Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 21, 2017, 11:46am UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/1 "2017-11-21T11:46:40Z")

</div>

Hi everyone,

Im scripting to create sheets from an excel template, to Revit with some conditions; and also write filtered parameters to sheets.

The condition is this:  
If excel cell of the I column is empty don’t extract all the information that excel contains. So don’t create a sheets if I is empty.  
Example: [https://imgur.com/a/Hhv6j](https://imgur.com/a/Hhv6j)

Now im with this: (Upper is correct I think, down side just for tests)

 ![1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/2/e20e6dcba1aba5a979adfcd2dc89fa0a51a79302.png)

I have the I column values filtered but I need to extrapolate to all the list.

Some clues and help?

Thanks in advice

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 21, 2017, 11:55am UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/2 "2017-11-21T11:55:40Z")

</div>

> [@xavierderos](#):
>
> I need to extrapolate to all the list

Could you elaborate a little on this point?

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [November 22, 2017, 12:54pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/3 "2017-11-22T12:54:08Z")

</div>

I THINK THIS COULD HELP YOU AS I UNDERSTAND:

 ![HELP1](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/c/9c10f21eb9838fdfd637b45b3d1f2c493b67c17b.png)

---

<div class="post-metadata">

**Author:** ![Yna\_Db](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/yna_db/32/30641_2.png) [@Yna\_Db](https://forum.dynamobim.com/u/Yna_Db)\
**Post date:** [November 22, 2017, 12:55pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/4 "2017-11-22T12:55:54Z")

</div>

Some explanation would be useful 🙂

---

<div class="post-metadata">

**Author:** ![khuzaimah.ElecEng](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/khuzaimah.eleceng/32/92768_2.png) [@khuzaimah.ElecEng](https://forum.dynamobim.com/u/khuzaimah.ElecEng)\
**Post date:** [November 22, 2017, 1:18pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/5 "2017-11-22T13:18:20Z")

</div>

as i understand he has an excel sheet with specific values in each column, but if any value is empty he want to remove all the row

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 22, 2017, 5:45pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/6 "2017-11-22T17:45:03Z")

</div>

Sorry, I hadn’t many time those days

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 22, 2017, 5:56pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/7 "2017-11-22T17:56:06Z")

</div>

Yes,is that but not for a **any value is empty in any column** , **only empty values in the column “i”**.

So I’m extracting all the information from excel and each column is in a indexed list.

USING THE IMAGE  
The values from the index number 3 have empty values, I want to remove all the empty values (3.2) on this sublist, and then, remove also the same subindex values in the other index list (X.2).

 ![2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/f/6f7f24d9c475b2ae79f7d33d5c278a2cd6054b83.jpg)

---

<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:** [November 22, 2017, 6:10pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/8 "2017-11-22T18:10:03Z")

</div>

Using your example above, you’re saying if any value of index 2 in any sublist is null, remove all items at index 2 for all sublists?

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

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 22, 2017, 6:56pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/9 "2017-11-22T18:56:59Z")

</div>

> [@Nick\_Boyts](#):
>
> in any sublist

near. Step by step, maybe is more easy, and sorry for my bad explanation

1. I want to detect all the empty values in list number 8.
2. Those empty index will be deleted.
3. I want to delete all those index for all the lists.

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 22, 2017, 7:05pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/10 "2017-11-22T19:05:10Z")

</div>

im very near.

 ![4](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/3/a3dde5a10fe807063889ffbe40e7c422cebe54ae.png)

---

<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:** [November 22, 2017, 7:36pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/11 "2017-11-22T19:36:01Z")

</div>

Why do you need to remove some nulls but not all? You can usually get by with nulls in your list just fine.

---

<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:** [November 22, 2017, 8:29pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/12 "2017-11-22T20:29:49Z")

</div>

If you’re trying to get rid of null values in just the 8th list you could do something like this.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/d/6d2c8a45e61d99788c44cfd00d99c9978a7aa9ea.png)  
I’m still not sure if it’s necessary to remove these nulls though. You’ll have to explain your reasoning so we can get a better idea of what the issue is. There might be a better workflow.

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 22, 2017, 11:56pm UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/13 "2017-11-22T23:56:04Z")

</div>

this is the script I want to do.

Objectives: I have an excel template to create sheets for a project.

Now: By the moment we use the schedules to replace the excel and make a sheet scope.

Idea: Use the template to create the sheets with dynamo. I have this sample. I want to read all the rows from my excel that have content in the M column. if any cell of the M column is empty, the row is not necessary because this are a titles not sheets.

 ![5](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/d/bdc7454d0f9e394927e81e150ab714dc87187fda.PNG)

---

<div class="post-metadata">

**Author:** ![awilliams](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/awilliams/32/114496_2.png) [@awilliams](https://forum.dynamobim.com/u/awilliams)\
**Post date:** [November 23, 2017, 2:02am UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/14 "2017-11-23T02:02:22Z")

</div>

@xavierderos this is similar to what @Nick_Boyts showed above, but uses a custom node from the DanEDU Dynamo package to find the indices of nulls in the sublists and eliminates the need for the Object.IsNull node

 ![remove blank rows](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/e/6e1d99aa9c371dd90e52849d4724966ab99b18ad.png)

---

<div class="post-metadata">

**Author:** ![xavierderos](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/xavierderos/32/36615_2.png) [@xavierderos](https://forum.dynamobim.com/u/xavierderos)\
**Post date:** [November 23, 2017, 11:15am UTC](https://forum.dynamobim.com/t/filter-sublists-by-conditions/16700/15 "2017-11-23T11:15:38Z")

</div>

YES! it works

 ![6](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/e/6e3f5c0178955e318b3733af359a116e02bee8c1.PNG)

Thanks for all!!
