[GIS] Iterate Workspaces in Modelbuilder not executing all tools

arcgis-10.0modelbuilder

I have a folder which contains a number of file gdbs. These gdbs all have the same structure i.e. a feature dataset FD_1 and several feature classes within the dataset (the two I am interested in are FC1 and FC2). The feature classes all have the same names within the gdbs.

I want to create tables from the feature classes, so my model does the following:
Iterate Workspaces produces Workspace (the path of the current gdb) and Name (the name of the current gdb). The Copy Rows tool is used to produce a table for FC1. The input table is specified using inline variable substitution

%Workspace%\FD_1\FC1

As is the output table

%Output%\table1_%Name%.dbf

The problem is, the Copy Rows process is not executing. The model simply iterates over the gdbs and then ends. When I check the Copy Rows window, it says that the input table does not exist. I tried setting Workspace as the Current Environment for the tool, but it didn't change anything.

Best Answer

What you are asking can be achieved in model builder, you need to create a sub-model. Also your current logic fails as you end up overwriting everything. I discuss that later.

The scenario as you describe is this:

Spoofed example

So your master model would be this:

Master model with workspace iterator

The Sub model would be this:

Sub model

  • Iterate Features must have recursive ticked on to get to the FeatureClasses in the FeatureDatasets
  • Copy the rows into an IN_MEMORY workspace, at this point you will have set the table name
  • Use Table to dBase tool to save out tables to dBase, this tool resolves issues with field names.

Your current logic will simply overwrite the output tables so you need to give them a unique name as they are all the same names in their geodatabases. You can achieve this when you copy the rows to in_memory by using the output name in_memory\%Name%_%nameFC%. This concatenates the geodatabase it came from with its FeatureClass name.

Related Question