Creating branches and options in model builder

06-27-2012 08:14 AM
New Contributor
Hello fellow ArcGIS users,

I´m using ArcMap 10.
I have been trying to include some options in a model I want to run.
At the moment I have gotten to the point where I can get a drop-down list with names as a model parameter in the modelbuilder.
The problem I´m having now is that I can´t figure out how to get a condition to work as follows:
If condition one is true (user selects option1) than go to this branch of the model.
Else go to next if statement.

I hope this is enough information, thank you in advance this would help out a lot!
0 Kudos
3 Replies
Esri Frequent Contributor
Here are a couple of resources that might get you in the right direction, I'm not sure if you've checked them out or not:

The first is the logic behind branching and included an if-else script in a model, and the second is a download from the Resource Center with a sample you can test with.
0 Kudos
New Contributor
Thank you for the fast replies,
I have been looking at both solutions offered but I´m not sure if the calculate value tool is the right one for what I´m trying.
The script is as follows:

# Import system modules
import arcpy
     # Get input arguments - table name, field name
Equation = arcpy.GetParameterAsText(0)
Input = arcpy.GetParameterAsText(1)
    #check if equation is chosen:
     if Input == Equation:
         arcpy.SetParameterAsText(2, "True")
         arcpy.SetParameterAsText(3, "False")
         arcpy.SetParameterAsText(2, "False")
         arcpy.SetParameterAsText(3, "True")

But I get an error saying there is a problem with the if statement.
Both inputs are defined as strings but "input" is chosen from a drop down list when the model starts.
0 Kudos