Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Syntax problem: If-Then

$
0
0
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:

Code:

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

the expression is:

Code:

CheckValueExists("%gefülltesFeldBis1%")
I get the error message
Quote:

ERROR 000989
Python-Syntaxfehler: Parsing error SyntaxError: invalid syntax (line 1)
Can anyone please explain what I do wrong?

Many thanks,
Tegir

Viewing all articles
Browse latest Browse all 2485

Trending Articles