# Run/Execute the whole script if it is true or else run/execute the other script

**URL:** <https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842>\
**Category:** Revit\
**Tags:** dynamo\
**Created:** [March 1, 2022, 6:29pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842 "2022-03-01T18:29:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 1, 2022, 6:29pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/1 "2022-03-01T18:29:07Z")

</div>

Hi all,

I have created two separate scripts to create grids for uniform and non uniform spacing. so If I set bool to true then the script for uniform grids creation should execute and if it is false then the other script for non uniform grids should execute.

I am trying the “scopeif” node but not able to proceed to execute the script. Please let me know the solution.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [March 1, 2022, 6:32pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/2 "2022-03-01T18:32:12Z")

</div>

Hey @shashank.baganeACM, have you searched the forums for similar topics already? There’s a lot of information about this scenario out there already. If you’ve found some helpful information could you then link it and explain what you’ve tried or where you’re having issues?

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 1, 2022, 6:36pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/3 "2022-03-01T18:36:59Z")

</div>

Hi @Nick_Boyts Thanks for response.

I have searched in forum but I found it for only for a node,

I wanted to execute the whole script it is true or if the user wants to create uniform grids.

If the user wants to create non uniform grids then he/she will select false then automatically the other script i.e non uniform script should execute based on the inputs. Can you please tell me how to do that ?

I am jus trying to use scopeif, but not able to run the script. I have got the path of files but not able to run.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [March 1, 2022, 6:41pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/4 "2022-03-01T18:41:57Z")

</div>

Try doing some more research on selectively running different parts of a graph. The information is already out there. If you have specific questions about that information we’d be happy to answer them.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [March 1, 2022, 6:45pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/5 "2022-03-01T18:45:38Z")

</div>

Here are a few topics that might get you started.

> [@Freezing / disabling / not running part of graph via dynamo player](https://forum.dynamobim.com/t/freezing-disabling-not-running-part-of-graph-via-dynamo-player/72128):
>
> Hi, I was wondering if it is possible to disregard and not run part of the graph via dynamo player. For example, lets say we have a dynamo graph that creates Floor Plan Views and Reflected Ceiling Plan views from a list in Excel. We can have all the inputs identified and use the Dynamo player to run the script once user picked all the inputs. If for example we have a project that does not require any Reflected ceiling plan, can the part of the graph that creates RCPs be disabled? Thanks

> [@Run one Script out of two, on the given condition](https://forum.dynamobim.com/t/run-one-script-out-of-two-on-the-given-condition/67289):
>
> Hey, I’ve a list of concrete elements and steel elements, but i want to run different scripts on them. If my parameter “Element material name” is “Concrete”, i want it to run script A onwards. AND DO NOT RUN SCRIPT B AT ALL! . Similarly, If my parameter “Element material name” is “Steel”, i want it to run script B onwards. AND DO NOT RUN SCRIPT A AT ALL! I know there are many solutions with if statements saying if input is true, run script, if false, do not run. But its not about true or false,…

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 4, 2022, 12:40pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/6 "2022-03-04T12:40:58Z")

</div>

I might not be seeing something here, but why not have two different graphs entirely, one for uniform spacing and one for non-uniform spacing?

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 4, 2022, 12:47pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/7 "2022-03-04T12:47:01Z")

</div>

Hi @jacob.small because the inputs for uniform grids and non uniform grids are different. I want to use input slider for uniform grids and excel sheet for non uniform grids as grids spacing along X and Y directions are different for non uniform grids.

If I run the non uniform grids script then it will ask me to enter the values in excel then it takes reference of entered values from excel then grids will be created.

If I want to run the script for uniform grids then I’ll give inputs as per the requirement like what will be spacing between grids along X and Y direction and what are the number of grids required and all…

So I have created two separate scripts for that to differentiate between uniform grids creation and non uniform grids creation.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 4, 2022, 12:50pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/8 "2022-03-04T12:50:53Z")

</div>

Ok, so why do you want these two similar but yet very different things in the same file?

“Create Uniform Grids via Excel.dyn”  
and  
“Create Non-Uniform Grids via Sliders.dyn”

Users pick which set of code they want to use by selecting which file to use.

I get ‘but that is one more file to use’ concerns, but it is likely less confusing for users. If this was a Revit feature would the completely separate UIs be triggered by making the users press a button, and then asking them which method, or would there be two different buttons? To me it sounds like two buttons.

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 4, 2022, 3:36pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/9 "2022-03-04T15:36:23Z")

</div>

Yes @jacob.small That is what I am basically trying to do. I want users to select the options from dropdown menu using UIs (data shapes package) but I am facing difficult to prepare it. Can you please tell me atleast basic graph to do that ? It would be very helpful !

I have created two separate scripts .dyn for uniform grids creation and non-uniform grid creation

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 4, 2022, 4:02pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/10 "2022-03-04T16:02:36Z")

</div>

I understand what you’re trying to do, but am questioning the “why”. What is the value in making two graphs which do two different things into a single graph?

Right now you have two graphs which make all the grids in a project, and users have to decide which one to use depending on the project’s needs. We are currently looking to make it one graph and once it starts running have it ask the users which method they would like to use. In the end it will still be two clicks, and a user will need to make a decision as to which is the right method for this project.

If we put these statements in front of your CEO, how much money do you think he would be willing to spend to achieve the single graph you’re chasing, knowing there are other issues out there which don’t yet have any easy button?

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 7, 2022, 9:30am UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/11 "2022-03-07T09:30:38Z")

</div>

Hi @jacob.small I understand that but we are trying to develop whole model using computational design concept. So please let me know basic graph to do that.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 7, 2022, 1:12pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/12 "2022-03-07T13:12:06Z")

</div>

The simple way: wrap the entire code base less the UI inside a custom node. No warning will be triggered by the side which doesn’t run as a result of null values being passed, and the final output will just be the resulting grids.

---

<div class="post-metadata">

**Author:** ![shashank.baganeACM](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@shashank.baganeACM](https://forum.dynamobim.com/u/shashank.baganeACM)\
**Post date:** [March 7, 2022, 3:58pm UTC](https://forum.dynamobim.com/t/run-execute-the-whole-script-if-it-is-true-or-else-run-execute-the-other-script/73842/13 "2022-03-07T15:58:13Z")

</div>

Hi @jacob.small @Nick_Boyts Thanks for the idea. I really appreciate for giving your valuable time. Thank you so much.

Here is the script I have modified that works fine for me.

[Parametric Grids creation.dyn](https://forum.dynamobim.com/uploads/short-url/T4KEVAhxNGqkVRHC2PBxyQeHt3.dyn) (204.7 KB)
