Get parameter values when nulls are present WITHOUT warnings

Given a list of space elements and nulls, I’m trying to report the space name and number (when there is a space), and some text value when there is a null.

I have a code block that does exactly what I want (top right), but it throws a warning “Warning: Internal error, please report: Dereferencing a non-pointer”. I think the error is because every line of code in the code block is executed and it’s getting mad at the null.

I think I can get around this with an imperative block (bottom right), but I apparently don’t understand what I’m doing here (compare index 1 and 2 in each list).

What am I doing wrong? I would be happy with a code block solution or a Python solution.

Please forgive me if this was answered on another thread, I tried searching but couldn’t quite fit the pieces together.

Since the first code block works, I’m guessing the issue isn’t the nulls. Try filtering out all the nulls and running just the second part of the statement (the space parameter part) on all your spaces. I see you’re using Room Number and Room Name instead of Space Number/Name. I’m guessing you have unplaced Spaces in your list that are missing those parameters.

Also, sometimes when you get an error like that in a code block you just have to disconnect and reconnect the input to let it fully refresh.

Hello try room status from datashapes it works on spaces as well

1 Like

@Nick_Boyts, if I filter out the nulls, the code works without errors. The only spaces that will be present in this list are placed spaces as I am getting them from SpacesAtPoint. The disconnect/reconnect doesn’t clear the error. I’m pretty sure the error is because the second part of the code (get Room Number and Room Name) is being executed for null values.

@sovitek, I’m starting with points in the model and trying to work back to spaces, so I don’t think the Room Status node will help much. However, I imitated your use of the Function Apply node, and it seems to do what I want now with no warnings. So Thanks!

For my own edification, I’d still like a little cleaner solution (with a code block or Python), but for now this gets the job done.

The issue is due to having a null as the first item in your list of spaces. I thought this issue had been fixed, but apparently not completely.

A null as the first item is causing the parameter portion to fail even though the initial condition is running correctly. The easiest fix is to remove the nulls as previously mentioned. Otherwise python would be an easy alternative for the time being.

@solamour, am I misremembering a fix for this?

2 Likes

Hi Nick didn’t know there should be a fix for that if so it have never works for me…so thats why function apply…but new to me it works so long a null doesnt come first in the list :wink: funny :wink:

It’s always worked as long as the null (or empty list) wasn’t first. You just had to handle the nulls appropriately.

Dynamo fails iterating through the list if the first item is a null or empty list. But I thought that part was fixed so that list still populates at least. I must be mistaken though.

1 Like

Cheers ,I try to stay away from null—normally hehehe

Dynamo Revit also has “Rooms By Status” out of the box since Revit 2021 :slight_smile:

The PR is here Ui nodes by SHKnudsen · Pull Request #2512 · DynamoDS/DynamoRevit · GitHub so you can see the code, and look to replicate for Spaces if you want to go down that path!

1 Like

Strange… I wasn’t aware of this issue. But can log it to investigate :slight_smile:

yes, but i just like to use datashapes i works on spaces as well and on links…i almost only use spaces but also on link for tjek rooms…thanks Sol

1 Like