Insert more than one iterator in one model

637
8
02-08-2017 10:30 PM
Status: Open
AhmadSALEH1
Occasional Contributor III

It would be great if the user will be able to insert more than one iterator in the model.

Thanks,

Ahmad Saleh

Tags (2)
8 Comments
NeilAyres

Once you have gone beyond a certain level of processing complexity, it is probably better to pythonise the code.

It will be faster and more efficient.

AhmadSALEH1

Hi Neil,

Thanks for your comment, I am aware that this could be done using python, meanwhile a lot of users can’t write python scripts. This idea was written in order to help those users and to make their life easier.

Thanks

NeilAyres

"can’t write python scripts"

Well, once you have gone beyond a certain level of complexity, getting the process into python can be very fulfilling.

There are lots of code snippets in the standard help files and many more here and elsewhere.

I would regard be able to have some basic understanding of scripting a required skill.

And it's not that difficult.

AshleySuiter3

Have you tried creating a model for one process (or series of processes) requiring iteration and then adding that model as a tool to a second model that also has iteration?  I have used this method in model builder when I have a workflow requiring multiple iterators.

KoryKramer

Here is what Ashley was referring to: Integrating a model within a model—Help | ArcGIS Desktop 

This way, more complex models can be composed of submodels, each of which contains its own iterator.

BrianWilson

But imagine how fulfilling it would be for the programmers at ESRI to add support for multiple iterators in a model!

I try to set up tools for people who can't use Python, and found this "one iterator per model" limitation (which BTW I don't see documented) to be highly amusing. It seems totally arbitrary to me.

After playing with iterators for 15 minutes, I wanted to nest a feature class iterator inside a workspace iterator. Seemed simple and elegant. Oh well. 

If you can grasp what an iterator is you can probably make the jump to Python.

BrianWilson

After thinking about it yesterday I wrote a python iterator tool,it builds a list of the feature classes in a workspace and then returns the list. The next tool in the chain has to accept a list of feature classes. A model looks like this.

model with iterator  

"Message tool" is just a generic thing that prints out what comes in. So running the second chain generated this:

First you see the output of the Iterator_Workspace tool as it walks the FGDB, then you see Message_tool dump the output from the tool.

Executing (Iterate_Workspace (2)): tool C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb
Start Time: Fri Jun 1 09:23:05 2018
Running script tool...
taxlots_fd\mapindex_lines
taxlots_fd\mapindex_points
taxlots_fd\taxcode_lines
taxlots_fd\taxcode_points
taxlots_fd\taxlot_lines
taxlots_fd\taxlot_points
taxlots_fd\mapindex
taxlots_fd\taxlots
taxlots_fd\taxcodes
taxlots_fd\mapindex_poly
taxlots_fd\mapindex_dissolved
taxlots_fd\taxcode_poly
taxlots_fd\taxcodes_dissolved
taxlots_fd\taxlots_poly
taxlots_fd\taxlots_dissolved
annotation_fd\bearing_anno
annotation_fd\seemap_anno
annotation_fd\taxlot_anno
annotation_fd\taxcode_anno
annotation_fd\taxmap_anno
water_lines
reference_lines
plss_lines
cartographic_lines
corners
plss
plss_tr
Completed script tool...
Succeeded at Fri Jun 1 09:23:16 2018 (Elapsed Time: 11.26 seconds)
Executing (Message_tool (3)): Message_tool # C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_points;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_points;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlot_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlot_points;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcodes;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_poly;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_dissolved;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_poly;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcodes_dissolved;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots_poly;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots_dissolved;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\bearing_anno;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\seemap_anno;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxlot_anno;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxcode_anno;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxmap_anno;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\water_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\reference_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\cartographic_lines;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\corners;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss;C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss_tr # #
Start Time: Fri Jun 1 09:23:16 2018
Running script Message_tool...
Running the Message tool.
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_points
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_points
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlot_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlot_points
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcodes
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_poly
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\mapindex_dissolved
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcode_poly
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxcodes_dissolved
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots_poly
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\taxlots_fd\taxlots_dissolved
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\bearing_anno
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\seemap_anno
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxlot_anno
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxcode_anno
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\annotation_fd\taxmap_anno
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\water_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\reference_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\cartographic_lines
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\corners
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss
C:\GeoModel\Clatsop\Workfolder\ORMAP_Clatsop.gdb\plss_tr
Completed script Message_tool...
Succeeded at Fri Jun 1 09:23:19 2018 (Elapsed Time: 2.50 seconds)

AhmadSALEH1

I think if esri included this capability in the model builder it would be easier than using submodels. people can start doing their process automation without the need to learn how to code