Model Builder: Workspace Iterator

1938
2
10-26-2011 10:14 AM
PeterWilson
Occasional Contributor III
I'm looking for a way to iterate through all the file geodatabases under a directory which has folder for each filegeodatabase and add a domain to each file geodatabase using the geoprocessing tool "table to domain". I'm wanting to replace the geodatabase for each iteration based on a list of file geodatabases found under the directory within subdolders. I tried to use the new iterator option within modelbulder 10, but have been unsuccessful. I've attached a print screen of the current model as well as the folder structure that I'm trying to iterate through. Any advice in how to achieve this will be appreciated.

Regards
0 Kudos
2 Replies
ShitijMehta
Esri Regular Contributor
To use the workspace iterator you must put all your gdb under the same root folder. Set the input workspace to be that root folder and workspace type = FILEGDB, also check the recursive option.

If you don't set the workspace type to any thing (leave it blank) and just check the recursive option it will run through each folder and each gdb. You will then have to add a logic which checks if it is  a folder or a gdb and then branch your model based on it. It would be a round about way.

It would be easier to put all gdb under one root folder and iterate.
0 Kudos
JeremyJurick
New Contributor II
To use the workspace iterator you must put all your gdb under the same root folder. Set the input workspace to be that root folder and workspace type = FILEGDB, also check the recursive option.

If you don't set the workspace type to any thing (leave it blank) and just check the recursive option it will run through each folder and each gdb. You will then have to add a logic which checks if it is  a folder or a gdb and then branch your model based on it. It would be a round about way.

It would be easier to put all gdb under one root folder and iterate.


Hi shitijmehta,

Could you please post an example of how to add logic which checks if it is a folder or a gdb?  i have run into this same scenario multiple times where I cannot iterate through subfolders looking for file gdb's and am somewhat stumped on how to achieve this without moving all of the goedatabases into one subfolder.

Thanks,
Jeremy