How to Send an True/False if statement result down separate node paths

Hi all,
Is there any way to reverse the If statement to where it goes down different node trees based on if the test was true or false? I am making a drop-down selection and if the user selects walls I want it to go down one node tree and if they select roof want it to follow a different set of nodes. has anyone figured out a good way to do this? Normally with the If node you would have to make these 2 separate node groups before for true/False but hopefully someone knows how to do this for after?

1 Like

Probably the only way to do it without doing it in Python would be to use an If node to check on one path if Wall was chosen, send it through, otherwise send nothing. Then on the Roof path do the opposite, that way one branch executes nothing and the other executes with valid data.

There’s scopeIf as well which might work to some degree, but I’ve rarely had much luck with reversed If statements that use more than 1 or 2 nodes using the OOTB options.

2 Likes

If you are prompting for a user selection, i suggest using the Data-Shapes UI nodes. This way you will only deal with one selection

1 Like

I would use a Python-Node like Gavin told you or a Code-Block with an imperative language block which only runs if neccessary. Keep in mind that you have to do this for all following nodes of the unused path if you want that your code runs without the message ‘run completed with errors’. It’s annoying but it works.

2 Likes

Thanks for the Help Everyone!
I solved it by using Gavin’s Method of with the Additional If Node + False attached to it.
I guess I will live with the “Completed with warning” message every time for the sake of minimizing the python needed.

1 Like

I decided to try the imperative statement but it isn’t running correctly.
Do you have any guidance on making this imperative work? If a = false I don’t want it to continue executing the rest of the nodes but if the input is not false I want it to continue running

Don’t use “return = a” and use “return a” instead. Have a read here:

As far as I can see you would reveive the error message “run completed with errors” if a=b, because then the code block would return null to the next node.