Run a node based on true false

Don’y know if what I’m looking for is possible…
I’m working with schedules. I’m trying to have my script check the Revit file to see if a schedule with a specific name exists. If so, make the adjustments to the schedule. If not, create the schedule and fill it in with appropriate information.
I’m using the createschedule from archilab. The node works great as long as the schedule doesn’t exist. If it does exist the node errors out with a requires unique name warning.

So, my question is, does anyone know of a way (point me in the right direction) to keep a node from running if a true / false is triggered?

I know I can accomplish what I’m attempting with some python scripting but I thought I’d ask the experts before going that route.

Something like this should work.Capture

This should help. Let me know if you have any questions. Take a look at both post as ether one of them could be your solution.

1 Like

I am no expert, but I think that with that solution, both parts of the code will run, what changes is only the output of the If statement ; however the ScopeIf node might do the trick (but you have to be careful with the use of that node as all three inputs should be independant).

@Steven’s solution looks promising ! :slight_smile:

Another way of doing it would be, I guess, to combine the two solutions :

  • Encapsulate the two part of the code to execute into two custom nodes
  • Have an If statement return the appropriate custom node to execute
  • Apply the output of the If statement to your input.

It would still draw errors but possibly a filterbyboolmask, with a name check where true means a schedule with that name already exists and false means does not exist. Then the INs go to adjust existing and OUTs go to create new schedules?

Alternatively, if you don’t mind deleting the existing schedules and just using the code to remake them, you could go that route. I did something similar with filters, where I delete any existing filters with same name before making mine.

1 Like

Thanks for the input everyone.

The problem with this one is the node I was trying to use creates a a schedule as soon as it’s run.

It’s looking like I’ll have to do a little coding or go the create a temporary schedule and delete it.route. I have a feeling this issue might come up in the future which was one of the reason I was checking to see if anyone else had run into a similar problem.

can you show us your code? without seeing anything its really hard to provide exact help. Right now we are just providing possibility’s.

You can also use Transaction.Start and Transaction.End nodes if you need to check everything first, then create / modify as needed. Like @Steven said, it would be more helpful if there was something to review.

Thanks guys. Should have thought of before. Hopefully this explains the part that I was inquiring about.

I’m reading the first cell from the Excel file and using that as the name for the Revit schedule. I wanted to check Revit to see if the schedule exists. If not then go ahead and create the schedule. The ScheduleCreate node requires a name and will automatically run so I’ve provided a temporary name which will then be deleted.

I see there’s a runit input on the ReadExcel node and I was curious if there was a way to do a similar check before running the ScheduleCreate node.

As the Read Excel node is a custom node, you could totally double click on it and see how this part of the node has been developped, and maybe apply it to your current case.

I tried that. It appears to be running a custom script.

Try something like this.

You can also try this if you do not want the error.


Thank you. That code looks like it’s exactly what I’m looking for. I’m still pretty new to dynamo and am trying to become familiar with some of these techniques. I’ll give this a try in the morning

For my second example, you can check out these two pages for information on what I am doing. It should help you understand what’s going on. For the most part, though I did the same thing but put it into one code block so it will only run ScheduleView.CreateSchedule if it is not in the project. “x?” is an if statement (shown in link one).

Hope it helps,


Worked like a charm. Thanks.

I did run into one issue. When I used the ScheduleField node it gave me this warning.

I replaced it with this and it worked as expected.

“ScheduleField” as an element is a single field (or column of data) from withing the schedule- It will not return the parent (schedule) view’s name, but the name of the field.

Thats strange it did work for me is the example above. I questioned whether it would or not when I did it.

@tbh Glad, you were able to get it working. Can you please mark the post that solved your problem for others with similar issues?



One more question for ya. The code worked as expected. It creates the schedule if it doesn’t exist and ignores it if it does.
I have my data from the Excel file to populate the schedule but I can’t figure out how to actually grab the schedule to populate it with the data. The code returns the Empty List value.
I’ve been looking thru examples but they all seem to use the CreateSchedule node which returns the ScheduleView that then gets the data pushed thru to fill it in.

Do I need to push the data into the Code when I actually create the schedule? I’ve been trying different code to see if it would output the actually ScheduleView but nothing I’ve tried seems to work.


If the x or the Schdule input are empty lists, the code you wrote will always return an Empty List. This is due to how the If statement in DesignScript works. You’ll have to compute each value independently and then choose the one you want accordingly.

The best way to do it would be the following (consider that the inputs are true_value, false_value, boole to be the inputs):


So it would be in your case :

[Schdule,ScheduleView.CreateSchedule(category, name, scheduleType)][x?0:1]