Select to view content in your preferred language

Model only works in ModelBuilder window

3685
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
1 Solution

Accepted Solutions
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")

View solution in original post

19 Replies
DanPatterson_Retired
MVP Emeritus

when you double-click on the model in the toolbox, are you putting in parameters  in there?

It is the phrase ... Editor tracking applies to operations on existing datasets only. It does not apply to operations that create new datasets. ...

from

http://pro.arcgis.com/en/pro-app/tool-reference/data-management/enable-editor-tracking.htm

that has me wondering if any featureclass created can't be found

AgataZurek
New Contributor III

Yes, I am putting in the parameter of what Geodatabase to save the new feature class to. When I run just the part that makes the new feature class and adds some fields (original post picture ModelBuilder1.png) it runs successfully. I can select a geodatabase and it creates the table with the new fields. It seems like the added tool to enable editor tracking doesn't see that the table was successfully created. Is there some kind of a forced refresh I could add to the model?

0 Kudos
AbdullahAnter
Regular Contributor II

Try to make your Feature Class Name As Model Parameter.

0 Kudos
AgataZurek
New Contributor III

I tried that and it did not work. Thank you for the suggestion. I get two errors:

0 Kudos
AbdullahAnter
Regular Contributor II

could you change the geodatabase and retry?

0 Kudos
AgataZurek
New Contributor III

I get the same error no matter what geodatabase I select.

0 Kudos
AbdullahAnter
Regular Contributor II

are you sure that model works inside edit window , could you run entire model and attach screen shot?

0 Kudos
AgataZurek
New Contributor III

I just learned that it will run in ModelBuilder if it thinks the file exists. What I mean is: if I run it, it will get to "Output Feature Class (4)", then I delete the newly created feature class from the target geodatabase, and the rerun it, it will run to completion. So again, I think the problem is there I don't know how to tell the model to recheck if the input exists. It appears to be checking once at the beginning. Is there some way to force it to recheck while the model is running?

0 Kudos
AbdullahAnter
Regular Contributor II

Just follow my steps

make the feature class name as model parameter so that you can change the name every time run as tool.

0 Kudos