If Node only passing the first entry of a list, function working as expected, just losing data

I have a pretty large dynamo script I’ve been working on for a couple of months. I’m stuck with an issue where an IF Node is only passing the first item on the list being fed to FALSE.
I have 8 different lists compiling to my ‘Write to EXCEL’, and recent changes is causing me headaches!
I also need the row written horizontally, which seems to be giving me another layer of issues.
I don’t want to use any custom nodes at this point, there’s none in the entire script, and I see no reason the OOTB ‘IF’ shouldn’t work here.

Hard to give you a good answer without seeing the other input, but keep in mind your true and false inputs need to match in length and list structure.

You can also use the following codeblock shortcut if your inputs don’t match:

i = if_test ? 0 : 1;

Keep in mind this returns the entire input list, not individual values.


The page is arguing with a larger screenshot, trying to post more of the data being fed in now. So the if is a trigger if a parameter exists, to add it’s information (NET/GROSS state in the screenshot) to the list for the write. I’ve been successful getting it to work, but it writes the values vertically from my list structure. Working on a better screenshot!

Use the screenshot button in the upper right corner of the Dynamo window.

Hopefully this helps. I can post the script, but it works with a excel file and a number of project parameters that are custom. It takes a bit to get a working setup. (Also needs programmed Area data)

It’s too large (over 40MP) tried it, and the forum rejects the image size.

Yeah your inputs don’t match at all. Your true input is 16 sublists of individual items. Your false input is a single sublist of 17 items. Based on you test input I’m assuming you want one complete list or the other, in which case you should be able to use the Design Script I mentioned above.

Yeah, that’s exactly what I’m trying to do. I’m doing the same function on multiple lists upstream from here, but the lists are formed slightly different. I assume if you’re passing multiple lists it works without issue, but since I’m using two nested lists it’s causing issue?

The input lists just have to match.

Take your last image as an example:

The true and false inputs match in structure so the node knows how to handle them. If you supplied a single test input, the node would return the entire list of the corresponding input. You could also supply a list of test inputs that would have the node return each individual value depending on whether the respective input was true or false.

Your inputs do not match in length however, so the node only returns the first 16 items (the shortest list).

1 Like

Woah good to know. I’ll go back and check this. Worst case I’ll change it all over to design script where I have this happening.
Thanks for the tips here! I kept thinking it was just an issue with my list structure. Massive help!!

You were spot on, thanks again!!!