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.
@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.
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 funny
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.