0

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.

1 Answer 1

1

Your branching script has the code below:

import sys, os, arcpy

InputV=arcpy.GetParameterAsText(0)

if InputV==0:
    arcpy.SetParameterAsText(1, "False")
    arcpy.SetParameterAsText(2, "True")
    arcpy.AddMessage(InputV+": Running downgrade model branch")
else:
    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":
4
  • 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
    Commented Mar 25, 2012 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
    Commented Mar 25, 2012 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
    Commented Mar 25, 2012 at 23:18
  • Excellent! Glad to hear its working now.
    – PolyGeo
    Commented Mar 26, 2012 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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