ArcGIS Calculate Value tool - Python syntax error

المشرف العام

Administrator
طاقم الإدارة
I have a feature class within a file geodatabase.

I am using the "Iterate row selection" iterator in Model Builder to read each row in the FC.I am then using the "Get Field Value" tool to read the following 3 fields from each row:

"Status"

"User"

"Tile"

I then want to use the "Calculate Value" tool to return a string, which I will later use as a file path to copy a specific file.The logic is as follows:If "Status" is "Available", return C:\Data\ + "Tile"otherwise return C:\Data\ + "Tile" + _ + "User"

In the Calculate Value tool, I've put the following into the expression field:

a("%Status%", "%User%", "%Tile%")I've put the following into the Code Block:

def a(Status, User, Tile): if Status == "Available": return "C:\Data\" + Tile else: return "C:\Data\" + "Tile" + "_" + UserI have the "Data type" set as string.

My model is as follows:



I get the following error for my code block:

ERROR 000989Python syntax error: Parsing error SyntaxError: EOL while scanning string literal (line 3)I'm happy to have a solution using model builder or using a stand along python script.



أكثر...
 
أعلى