5

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.

2 Answers 2

2

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.

3
  • I was initially excited by this answer, but using a sub model didn't work for me. The child doesn't get fired, model screenhot. If I get time I'll try and distill to a toolbox I can post somewhere, but at the moment I'm inclined to side with Cindy's comment that Model Builder Iterators are just buggy. Commented Dec 7, 2015 at 23:52
  • @mattwilkie looking at your screen shot you are feeding a WORKSPACE into the Append tool which is not a list of Datasets. You need a sub-model that iterates through a WORKSPACE creating a list of FeatureClasses (see collects value tool) then the out of that feeds into your Append tool. I think what you are doing is sufficient enough to be a stand alone question.
    – Hornbydd
    Commented Dec 8, 2015 at 10:02
  • It's feeding %Workspace%\Dataset\FC_name to the append sub model, with Workspace being a precondition. Commented Dec 8, 2015 at 20:45
0

Trying to do the same thing, no luck either. The issues seems to be the 'iteratate workspaces'--it doesn't work as you'd expect, iterating over each folder in the directory. Thinking it's for renaming folders, and not much else.

You might try building most of your prcessess into a model, and then inputting the workspace as a multi-value.

1
  • 2
    I figured this is a bug in ModelBuilder, so I've long sinced moved to Python to do this sort of thing for me. Commented Nov 13, 2013 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.