Inconsistant output of IF?

This is driving me nuts! Why is it pushing the “False” result thru the IF statement if the trigger is reading True?
I’m trying to insert a value of 0 to a list if the list is empty, so the write to excel rows stay in order.

Hi @JPParker

Use ScopeIf node instead:

1 Like

Using 2.02 as soon as I ran the script with Scopeif it crashed taking revit down. Downloading 2.4.1 now hoping it’ll fix it. I don’t understand why scopeif and if are different here?

Hmm 2.4.1 seems to be sandbox, 2.03

Interesting. As soon as I hook a scopeif up to a node with data (Is.Empty=False) it crashes pushing the list result. I read scopeif will crash if the result is displayed in two lists, got an idea that might be crashing it…

Try using ScopeIF+ custom node from clockwork package.

I can’t, I need to stick with the out of the box nodes. I’m working with a number of people that nave never seen dynamo before, and the network installs are managed by a different group. Having to push custom nodes scares me keeping them all in sync company wide when we’re all across the entire US. I can write the information in a super sloppy dump to excel method instead if I can’t figure out where the crash is coming from.

Alright try this:

@JPParker Did it worked?

No, it fails when there’s a true value. Sorry, been messing with it the whole time trying to get it to work


If I go with a space instead of ; I start getting somewhere with it.

I ended up going with a “0” for ; at least it fills the void. Will work for what I need at least. Thank you for you help!

Stumbled across this, figured I probably could make it work someday, just suprized me it’ll pass a 0 with an empty list.

@JPParker,

Sorry to jump in, but i think i had a similar issue before. I hadn’t come across ScopeIF or ScopeIF+ at this point so i found an alternative way of getting around an issue of empty lists making IF misbehave.

Hopefully this code block works you.

Best,

Ben

It still seems to push the “Empty List” using this code block. I may not have it piped right based on the inputs you used. (In the screenshot, the Boolean input is coming from another flag to I can force false it. I tried a boolean too, but got the same result. Information flows as long as the value is “False” on List.IsEmpty

hi @JPParker,

To confirm, what is being passed into port c?

Could you upload your dynamo file so i could take a look?

Thanks,

Ben

Ahh I got it working. C was going to my boolean mask (in)output. I simply needed to read the code block. The output E performs the IF statement, I don’t run it into another one. I fed C a simple " ";

1 Like

Attached is the script if you’re curious. Please don’t mind the mess. It should open to the code placed at the bottom where this is in use. The two ‘branches’ are copies of what is already in place just above them.
I need to explore nested lists more…

IND_Area Totals_V2.0.dyn (399.4 KB)

I would just use a simple python script, that way it’s OOTB as you want too.

Python%20block

Empty%20list

I usually use the Zebra ‘Logic.If’ node but it isn’t OOTB of course… it’s contents are however exposed, it uses an internally defined function:

3 Likes

I would recommend getting rid of If nodes completely, try using FilterByBoolMask nodes instead.

Yeah, I’ve been using design script ever since this was brought up. IfScope is a guaranteed crash of any dynamo script I’ve used it in, IF fails to be reliable if there’s no list being passed.