Hello Team,
I am trying to run a simple model which iterating the feature classes within a geodatabase and copying them into another geodatabase.
The model run and copied the feature classes into the target geodatabase. But the issue is the fields of the output feature classes does not match the fields in the input geodatabase (Somehow it take the fields of the first feature class as a template and copy it to the other feature classes in the output). I found that in Esri document:
When this tool is used in a model, the first feature class is used as a template for the output. This allows for selection of fields in subsequent tools.
Is there a way that I can preserve the fields of output feature classes?
Solved! Go to Solution.
Thank you for the additional information as I found a BUG that likely explains this behavior.
BUG-000161459 - A model created in ArcGIS Pro 3.1.3, including an iterator and the Spatial Join tool with the merge rule set to 'Sum' for one of the attributes, executes unexpectedly. The output from the first iteration is correct, but for the following target feature classes, the tool reverts to the 'First' merge rule (the default rule option).
The BUG is currently under review and is not reproducible in ArcGIS Pro 2.9.x
So I built an ArcGIS Pro 3.2 model in modelbuilder that I use in Instructor Led classes to copy all the data from a folder of shapefiles to an Enterprise Geodatabase (as referenced below) and each feature class in the eGDB has their own unique attribute values vs. the first one being used as the template. I do not do any field mapping in the Fields parameter of the FC to FC GP tool in the model.
Hi @Robert_LeClair ,
I tried to mimic your ModelBuilder and converted the data to a shapefile but I am getting the same result again. Here is what I get when running the tool:
Input
Output: (this one copied without any issue since this the first feature class in iteration)
Input:
Output: (The schema of the feature class changed after copying it to match the first feature class)
The same happen to all feature classes/ Shapefiles.( It took the schema of the first feature class in the iteration)
The only difference between my test and yours is that I am using ArcGIS Pro 3.0
Interesting! I guess I never noticed this before but YES my model is doing the same thing. The first feature class is fine but all subsequent feature classes inherit the schema of the first. That's got to be a bug. So I started digging deeper and learned the Feature Class to Feature Class GP tool is deprecated (or soon will be) and that the Export Features GP tool is recommended. So I created a new model as seen below with the following settings. It worked! Each feature class has it's "own" schema as it were.
Also, no need to convert to a shapefile as the input workspace can be a folder of shapefiles, a file geodatabase or an enterprise geodatabase.
My model will also have the spatial join tool and it gives the same result (Copying the schema of the first feature class) the issue is reproducible with any tool that has the field map option
I belive it might be a bug specialy with the spatial join tool and FC2FC, but I would appricte your feedback if you can confirm that so I can look for any workaround
Thank you for the additional information as I found a BUG that likely explains this behavior.
BUG-000161459 - A model created in ArcGIS Pro 3.1.3, including an iterator and the Spatial Join tool with the merge rule set to 'Sum' for one of the attributes, executes unexpectedly. The output from the first iteration is correct, but for the following target feature classes, the tool reverts to the 'First' merge rule (the default rule option).
The BUG is currently under review and is not reproducible in ArcGIS Pro 2.9.x
Another update, I tested it by using Pro3.2 and got the same result