Dividing by "0" creating empty lists;

New to dynamo. I work in HVAC and was trying to work on something where dynamo will automatically calculate the supply airflow and return airflow based on the number of diffusers. When working on the return airflow side, I am having issues in spaces where there are no return diffusers.

In these rooms, the count of diffusers is 0, and when dividing the airlfow by 0 for these rooms, list.ofrepeateditem returns an empty list value which causes and error because of dividing by 0. I was looking to try and remove the 0’s from the list by using list.clean but not sure if I’m on the right track. Any help would be greatly appreciated.

Connect your list of numbers to a > node which you’ll find in the Operations library. In the second input connect 0 (I assume it would never get negatives?).

Connect this to a filter by book mask node (this is your mask), and in its list input connect your number list. The IN output will now contain a list of numbers that are greater than 0. This is one of many ways to do it.

Another way is to get the index of the 0 and remove the item at the index…

Awesome, that worked perfectly. Leads to another issue I have now. If the space does not have a return airflow, the value is 0. I try to filter out that 0 using the same method, but I receive an empty list. Because of this the space after this will receive a 0 value for the diffuser.

You are feeding it a string value instead of a numerical value. Try removing the 2 quotation marks around the zero.

Thanks for the response. Removing the quotation marks also returns an empty list

I think it’s because the zero is an integer and the parameter values are doubles. Try replacing the 0 with 0.0. That way it will become a double instead of an integer.

That did it! Thanks!