I think I may have found a ModelBuilder bug.
Would it be possible for someone to try and follow my procedure to see if they agree, and if so, to try and suggest a workaround that still uses ModelBuilder, other than only ever running this model while it is open for editing?
I already know how to do this using ArcPy, but I was trying to show how easy it was to do using ModelBuilder too.
I'm happy to accept an answer without it containing a workaround because what I am really after is a sanity check on my procedure and observed results. If it is a bug I would be keen to know an NIM number and whether it is fixed in the ModelBuilder from either or both of the ArcMap and ArcGIS Pro applications of ArcGIS 10.3 for Desktop.
I am using ArcGIS 10.2.2 for Desktop and a File Geodatabase. I have my Geoprocessing environment set to overwrite.
- I used Create Fishnet to create a 2x2 fishnet with cells 1x1 in size called FishnetFC, added a field called Name and updated that field so that the attribute table has the appearance below. Using any polygon feature class with any field of type text populated with unique vales should be fine to test with.
- I then made the model below which has no parameters
- I configured the Iterate Field Values tool as below
- I configured the Select tool as below
- The Value variable is a precondition to the Select tool but that does not appear to be important because I have tried with and without that.
- When I run the model while it is open it produces four feature classes called FC1, FC2, FC3 and FC4 as expected
The output is:
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:03:02 2014
Succeeded at Tue Nov 11 17:03:02 2014 (Elapsed Time: 0.06 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC1 "Name = 'FC1'"
Start Time: Tue Nov 11 17:03:02 2014
Succeeded at Tue Nov 11 17:03:02 2014 (Elapsed Time: 0.44 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:03:03 2014
Succeeded at Tue Nov 11 17:03:03 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC2 "Name = 'FC2'"
Start Time: Tue Nov 11 17:03:03 2014
Succeeded at Tue Nov 11 17:03:03 2014 (Elapsed Time: 0.46 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:03:03 2014
Succeeded at Tue Nov 11 17:03:03 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC3 "Name = 'FC3'"
Start Time: Tue Nov 11 17:03:04 2014
Succeeded at Tue Nov 11 17:03:04 2014 (Elapsed Time: 0.44 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:03:04 2014
Succeeded at Tue Nov 11 17:03:04 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC4 "Name = 'FC4'"
Start Time: Tue Nov 11 17:03:04 2014
Succeeded at Tue Nov 11 17:03:05 2014 (Elapsed Time: 0.39 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:03:05 2014
Succeeded at Tue Nov 11 17:03:05 2014 (Elapsed Time: 0.00 seconds)
- When I save and close the model, before running it that way instead it produces only two feature classes called FC1 and FC2 - I think this has to be a bug!
This time the output is unexpectedly as below. I have placed asterisks (**) where it departs from what I would have expected.
Executing: SelectByAttribute
Start Time: Tue Nov 11 17:04:34 2014
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:04:34 2014
Succeeded at Tue Nov 11 17:04:34 2014 (Elapsed Time: 0.05 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC1 "Name = 'FC1'"
Start Time: Tue Nov 11 17:04:34 2014
Succeeded at Tue Nov 11 17:04:34 2014 (Elapsed Time: 0.28 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:04:34 2014
Succeeded at Tue Nov 11 17:04:34 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC2 "Name = 'FC2'"
Start Time: Tue Nov 11 17:04:34 2014
Succeeded at Tue Nov 11 17:04:35 2014 (Elapsed Time: 0.27 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:04:35 2014
Succeeded at Tue Nov 11 17:04:35 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): **Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC1 "Name = 'FC3'"**
Start Time: Tue Nov 11 17:04:35 2014
Succeeded at Tue Nov 11 17:04:35 2014 (Elapsed Time: 0.39 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:04:35 2014
Succeeded at Tue Nov 11 17:04:35 2014 (Elapsed Time: 0.00 seconds)
Executing (Select): **Select C:\polygeo\test.gdb\FishnetFC C:\polygeo\test.gdb\FC1 "Name = 'FC4'"**
Start Time: Tue Nov 11 17:04:35 2014
Succeeded at Tue Nov 11 17:04:36 2014 (Elapsed Time: 0.45 seconds)
Executing (Iterate Field Values): IterateFieldValues C:\polygeo\test.gdb\FishnetFC Name String false false #
Start Time: Tue Nov 11 17:04:36 2014
Succeeded at Tue Nov 11 17:04:36 2014 (Elapsed Time: 0.00 seconds)
Succeeded at Tue Nov 11 17:04:36 2014 (Elapsed Time: 1.89 seconds)