I have problems integrating a python script in a modelbuilder tool. I'm a absolute beginner with python. Maybe there's also an easier way to solve this problem in modelbuilder without using a python code, but I haven't found it yet
so here's my problem:
my modelbuilder tool's flow of control needs to evaluate a situation and decide on one of two courses of action: If the value in the field "Building" in my feature class is 1, it should follow one path, if the value is greater than one it should follow another path.
Here's my python code that I tried so far, but didn't work.
# Load the arcpy module import sys, os, arcpy # Get the input feature class from the model InputFC = arcpy.GetParameterAsText(0) field = "Building" cursor = arcpy.SearchCursor(InputFC) # check if one or more than one building footprint exist for row in cursor: Building =(row.getValue(field)) if Building == 1: arcpy.SetParameterAsText(1, "True") arcpy.SetParameterAsText(1, "False") else: arcpy.SetParameterAsText(1, "False") arcpy.SetParameterAsText(2, "True")
any help on this problem is much appreciated