Model only works in ModelBuilder window

3118
19
Jump to solution
03-17-2018 01:32 AM
AgataZurek
New Contributor III

I made a model that creates a feature class, adds some fields and then enables editor tracking. I can get it to work in the ModelBuilder window but not by double clicking/opening it from the toolbox. The error I get is 000110: <target feature class> does not exist. The first two parts work just fine, it creates a feature class and adds the fields, but it comes up with that error when I include "enable editor tracking" in the model. I modified it to use the first part as a tool to chain the second part to, but I get the same error message. Please see pictures of my model for details.

I found a similar problem here: ArcGIS ModelBuilder model works in Edit windows but not from the "open" window - do you have any exp...  but the solution did not work for me.

Any help would be appreciated. Thank you.

0 Kudos
19 Replies
AgataZurek
New Contributor III

Maybe I don't understand which parameter you mean because when I tried what you are suggesting, I get the same error 000110. I have circled which parameter I think you are talking about (see below). Is that right? If so, it is not making a difference.  Also, part of the purpose of the tool is to have the name of the feature class be the same every time, I don't want it to be an option to change it.

0 Kudos
DanPatterson_Retired
MVP Emeritus

You may need to set your environment variables to 'overwriteOutputs'  I know you can do it in scripting, but at the model level I don't know.

In any event, if it exists and it can't be overwritten, then it would need to be deleted before it continues

AgataZurek
New Contributor III

Where can I find the environment variable 'overwriteOutputs'? Also, the error is telling me it can't find the newly created feature class; how would deleting it help? Or I don't know which part you mean for me to delete.  Thanks!

0 Kudos
AbdullahAnter
Occasional Contributor III

Dan is right maybe you doesn't active overwrites the outputs of geoprocessing operations..

You will find it in geoprocessinggeoprocessing options  as the following picture.

0 Kudos
AgataZurek
New Contributor III

I looked into the settings and it was already checked.

0 Kudos
curtvprice
MVP Esteemed Contributor

You can refresh the catalog with the Calculate Value tool with the expression arcpy.RefreshCatalog(r"%Select Geodatabase%") with Output Feature Class(4) as a precondition and the output a precondition to Enable Editor Tracking. Not so sure that would work, but it is something to try.

Another workaround I have used when a tool is giving me Model Builder parameter validation trouble is to embed the tool run in a Python function inside a Calculate Value tool code block. A pain but useful if you want to avoid creating a script tool.

AgataZurek
New Contributor III

Thank you, that's a great idea.

0 Kudos
AbdullahAnter
Occasional Contributor III

Could you move your question to https://community.esri.com/groups/model-builder to get better answers.

0 Kudos
AgataZurek
New Contributor III

Moved. Thank you, this was my first time posting in a long time and I had trouble finding the most appropriate place to post to.

0 Kudos
AgataZurek
New Contributor III

I fixed my own problem by converting the model to python and adding in a line that refreshes the catalog. Code and line that fixed it in bold near bottom. I set one parameter to name: 'Select Geodatabase' type: 'workspace'. I also made sure the output feature class was using the selected geodatabse with the feature class name I wanted to use.

# Import arcpy module
import arcpy

# Script arguments
Select_Geodatabase = arcpy.GetParameterAsText(0)

# Local variables:
Feature_Class_Name = "Geofeatures_points_SCL"
Geometry_Type = "POINT"
Coordinate_System = "PROJCS['NAD_1983_UTM_Zone_11N',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',500000.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-117.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]];-5120900 -9998100 10000;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision"
Output_Feature_Class = Select_Geodatabase + "\" + Feature_Class_Name
Output_Feature_Class__2_ = Output_Feature_Class
Output_Feature_Class__3_ = Output_Feature_Class__2_
Output_Feature_Class__4_ = Output_Feature_Class__3_
Geofeatures_points_SCL = Output_Feature_Class__4_

# Process: Create Feature Class
arcpy.CreateFeatureclass_management(Select_Geodatabase, Feature_Class_Name, Geometry_Type, "", "DISABLED", "DISABLED", Coordinate_System, "", "0", "0", "0")

# Process: Add Field: TYPE
arcpy.AddField_management(Output_Feature_Class, "TYPE", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Field: LABEL
arcpy.AddField_management(Output_Feature_Class__2_, "LABEL", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")

# Process: Add Field: COMMENTS
arcpy.AddField_management(Output_Feature_Class__3_, "COMMENTS", "TEXT", "", "", "100", "", "NULLABLE", "NON_REQUIRED", "")

arcpy.RefreshCatalog(Select_Geodatabase)

# Process: Enable Editor Tracking
arcpy.EnableEditorTracking_management(Output_Feature_Class__4_, "", "DATE_CREATED", "", "", "ADD_FIELDS", "DATABASE_TIME")