Import Feature Classes

448
7
03-21-2013 09:16 AM
MarkYoung
Occasional Contributor
Hi,
I am trying to create a model whereby a new file geodatabase is created  (done that bit) and all feature classes from another file geodatabase are loaded into the newly created file geodatabase (I cannot simply copy the geodatabase it has to be a new geodatabase then add the feature classes). Once the feature classes are in I need to delete three fields from each feature class.

I have tried using iterate - feature classes, adding the existing geodatabase then using the feature class to feature class tool to export to the new geodatabase but it only lets me do one feature class at a time.

regarding the delete fields I added the delete field tool and specified the fields to delete but I am unsure how to iterate through the feature classes as the option to iterate is greyed out.

Any help - most appreciated,
thanks
Mark
0 Kudos
7 Replies
MatthewPayne
Esri Contributor
Hi Mark,

I believe the issue you are facing in Model Builder is that the iterator will iterate each process within the model, thus, creating the new file geodatabase during each iteration.

Try using this Script Tool I made that was created using Python.

Matt
0 Kudos
MarkYoung
Occasional Contributor
Hi Matt,
Many thanks for the script. When I opened it looks to be what I am after - however it failed;

ERROR 000576: Script associated with this tool does not exist.
Failed to execute (Script).

When I try and edit the file it says it cannot find the file.

Thanks
Mark
0 Kudos
MatthewPayne
Esri Contributor
Hi Mark,

Try this one.  Let me know if it has any issues as well.

Matt
0 Kudos
MarkYoung
Occasional Contributor
Hi Matt,
No just the same error I am afraid. I am just double clicking on the script to open, enter the parameters of the new fgdb, the existing fgdb and the fields to remove.

Thanks
Mark
0 Kudos
MatthewPayne
Esri Contributor
Hi Mark,

The issue was on my end.  Give this one a try.  Once you download and extract the toolbox, you'll want to browse to the script tool in ArcCatalog, right-click it, go to the Source tab, and path to the .py file that is located in this attached folder.  After that, it should be good to go.  Let me know if the issue arises again!

Matt
0 Kudos
MarkYoung
Occasional Contributor
Hi Matt,
Changed the file path to my own directory and the script runs. It creates the new gdb ok but fails and I have found out why as my original way of thinking will not work.

What I have are feature classes containing three offending fields ([Created] [ModifiedBy] and [ModifiedLast]) which were created by a timestamper plugin. This plugin no longer works on win7 64 bit OS so the aforementioned 3 fields need to be removed as it renders various feature classes unusable. I had thought that if I created a new FGDB, deleted the fields from the original database then copied the adjusted feature classes to the new fgdb it worked (effectively stripping out the COM or timestamper component)  but it doesn't - when I try and open one of the feature classes I still get a COM error which is the OS complaining about the timestamper plugin.

It looks like it will be a manual process to achieve this as what I need to do (only way I can see it anyway) is quite involved.
I need to create a new FGDB like before and create a new feature class for every existing feature class thats in the original database importing the existing field structure then deleting the three fields.

Thank you very much for your help with this so far and I apologies I got the process wrong.
Mark
0 Kudos
MatthewPayne
Esri Contributor
No problem, Mark.  Thanks for letting me know.  Yea, sounds like the level of detail to fix the issue caused by the plugin is going to more than likely need to be done manually. 

Have a great week!

Matt
0 Kudos