python script in modelbuilder get field value return boolean expressions

Discussion created by nmuehlich on Apr 26, 2013
Latest reply on Mar 22, 2016 by curtvprice
I have problems integrating a python script in a modelbuilder tool. I'm a absolute beginner with python, any help is much appreciated. Maybe there's also an easier way to solve this problem in modelbuilder, 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

# 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")
        arcpy.SetParameterAsText(1, "False")
        arcpy.SetParameterAsText(2, "True")