tegir

Syntax problem: If-Then

Discussion created by tegir on Jul 9, 2013
Latest reply on Jul 23, 2013 by tegir
Hi,

I have a problem with the syntay of python and hope to get some help.
In Model Builder I have a table and want to check wether a certain field in the table contains a value or is empty. So I use the 'calculate value' with a boolean data type. My code looks like this:

def CheckValueExists(gefülltesFeldBis1):
import arcpy
if  gefülltesFeldBis1 != '':
    return "true"
else:
    return "false"


the expression is:

CheckValueExists("%gefülltesFeldBis1%")


I get the error message
ERROR 000989
Python-Syntaxfehler: Parsing error SyntaxError: invalid syntax (line 1)


Can anyone please explain what I do wrong?

Many thanks,
Tegir

Outcomes