Timeline for Check for field, add or skip to next step if exists in ModelBuilder?
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 21, 2021 at 5:33 | comment | added | ndthl | Thanks, I fixed this: hasField(r"<path>.gdb\%Name%") | |
Jan 20, 2021 at 12:26 | comment | added | Hornbydd | So you can see that %Name% is replaced by the text SWARBYCH, it is not the full path name to your featureclass, it's a layer name, the line of code referring to workspace, see how it sets it to the dirname of the dataset, you have passed in literally the text SWARBYCH and not something like c:\temp\data\SWARBYCH.shp | |
Jan 20, 2021 at 11:18 | comment | added | Hornbydd |
You don't appear to have provided an input it says hasField(r"") , note I provide a layer name using inline variable substitution hasField(r"%FeatureClass%") .
|
|
Jan 20, 2021 at 10:50 | comment | added | ndthl | I would appreciate some help on this error. It says the feature class does not exist: ERROR 000539: Error running expression: hasField(r"") Traceback (most recent call last): File "", line 1, in File "", line 4, in hasField File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy_init_.py", line 1139, in ListFields return gp.listFields(dataset, wild_card, field_type) File "c:\program files (x86)\arcgis\desktop10.6\arcpy\arcpy\geoprocessing_base.py", line 346, in listFields self._gp.ListFields(*gp_fixargs(args, True))) IOError: "" does not exist Failed to execute (Calculate Value). | |
Dec 9, 2016 at 17:49 | history | edited | Hornbydd | CC BY-SA 3.0 |
Added more advice
|
Dec 9, 2016 at 17:16 | history | answered | Hornbydd | CC BY-SA 3.0 |