AnsweredAssumed Answered

Python Code Assist!!!

Question asked by Shiko on Jul 15, 2013
Latest reply on Jul 16, 2013 by stacyrendall
I'm trying to check for the existence of data within a particular attribute field in a given shapefile.
Below is the code I'm working with (on model builder) which I know needs major debbuging...but I'm not sure how.

Expression
x("%Taxlot%", "%Workspace%")

Code Block
def x(Taxlot, Workspace):
    import arcpy
    arcpy.env.workspace = Workspace
    if arcpy.Exists(Taxlot):
        return "true"
    else:
        return "false"

Data type
Boolean

The result I get when I run this piece is always "false", even when I think it's true :confused:

Note: "Taxlot" is the name of the model parameter which accepts a list of values from the user.
The code is supposed to check these input values against "Workspace", which is the name of the shapefile that holds the attribute table where the field of interest is.

This might be a little confusing but I can clarify for anyone that may have a suggestion or actual code to achieve this.
Thank you much!

Shiko

Outcomes