Formula breaks on nulls

Hi all,

as usual my brain refuses to grasp the simplest things… :frowning:
See below:

Works in Revit 2024 (see below). What is the error showing?

Thank you Mike, but it does not work for me, even using the @L1s as you did:

What does the warning say for this code block? It should tell you what the issue is.

Hi Nick,
I get the same error, this one:

It shouldn’t be dealing with the nulls, so let’s just start with a simple version. What happens if you try something like:
a != null;
That should return the same boolean list that you have already.

Then you can step up to something like:
a != null ? "group" : "no group";
That should still work and reaffirm which items are valid groups and which are not.

If either of those attempts gives you a warning it may shed some additional light on what the issue is.

Another thing you should probably try is to filter the groups and make sure each one of them successfully returns a Name and an Id to confirm that it’s not a Group that’s failing.

Thank you Nick,

However, Mike’s test works as expected, so I am afraid this is an issue with my install of Dynamo and /or some package / plug in…?

In any case, by pre-screnening the valid value and avoiding feeding a null to the .Name or .Id code, I was able to get what I need…

(Also, notice I had to use @L2 and @L1 in the IF node to get the final list)

Nick, your code works, not a problem, because it does not use the “.” notation, like g.Name.

The issue is the Null values.
If I use a list of data with no nulls values, it works:

Yes, we all understand that it should work, but we have to confirm all the individual steps to identify why it’s not. If you can confirm that everything works as expected individually but just not when wrapped up into one conditional, then you’re right, it could be a conflict with another install, but I’ve never seen that without a warning pointing in that direction. If you just want a working fix, then the easiest thing would be to write a conditional in python and completely skip over the nulls. Also, the example from @Mike.Buttery should actually have the same/similar issue since the nulls wouldn’t have a Name or Id - so that seems a little weird.

I guess all I am saying is that I cannot reproduce Mike’s example which does not work for me, and I get nulls instead of those [group].Name and [group].Id

If there are no Nulls in the list of data, it works as expected.

It shouldn’t be dealing with the nulls, so let’s just start with a simple version. What happens if you try something like:
a != null;
That should return the same boolean list that you have already.

Then you can step up to something like:
a != null ? "group" : "no group";
That should still work and reaffirm which items are valid groups and which are not.

These tests that you are suggesting work fine on my end.

Thank you

If you want to share an example model and script where this is reproducible then we can see if it’s something in your model or something on your machine. But if you have something working then it may not be worth tracking down at this point.