Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having an issue with a branching model when the iteration tool is used. The test code/scripts/models are in Google docs or arcgis forums

It runs and creates both versions of the process whereas it should only have either _GradedNULL or GradedDown. The test is simple and works.

The reason to do this is that the grading down set of processes takes a few hours to complete on each of the input text file and each area has more than 70. So if this branching worked it would save days of processing time.

share|improve this question
up vote 1 down vote accepted

Your branching script has the code below:

import sys, os, arcpy


if InputV==0:
    arcpy.SetParameterAsText(1, "False")
    arcpy.SetParameterAsText(2, "True")
    arcpy.AddMessage(InputV+": Running downgrade model branch")
    arcpy.SetParameterAsText(1, "True")
    arcpy.SetParameterAsText(2, "False")
    arcpy.AddMessage(InputV+": Running simple (null) model branch")

but when you bring in the parameter you say to get it as text so I think it needs to have double quotes around the 0 when you pass that in i.e.

if InputV=="0":
share|improve this answer
GetParamaterAsText doesn't mean "text" as against "float" etc. It's just the way input is called in. The type of acceptable values is set in the properties of the tool from ArcGIS. The script works when not in a iterate model, the main issue is that when the iteration is added to the model it runs both branches and so is pointless and in fact wastes more time. The whole point of branching is to save time in only running the downgrade model if more than one signal strength group is found. – GeorgeC Mar 25 '12 at 10:36
I checked the script as my first step to looking at this, and found it only ever ran one branch because GetParameterAsText returns a string no matter what the tool parameter type is set to. I entered 0 and found it ran the else condition. – PolyGeo Mar 25 '12 at 12:14
Thanks. One issue was the '0' and the other one was that all actions after the branch needed to have pre-conditions set as well, not just the first action after the branch. – GeorgeC Mar 25 '12 at 23:18
Excellent! Glad to hear its working now. – PolyGeo Mar 26 '12 at 0:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.