The iterator of main model can only be iterated once in ArcGIS Pro2.8.3

1714
11
12-04-2021 07:40 PM
圈圈
by
Occasional Contributor

I'm building a model and adding a submodel, both of which have an iterator.  When I run the model in Pro2.5, it is fine. But When I run the model in Pro2.8.3, I find that the iterator in the main model only runs once, and the iterator in the submodel runs fine.Is this a known bug about ArcGIS Pro2.8.3?

11 Replies
DanPatterson
MVP Esteemed Contributor

Things may have changed,

Add a submodel to a model—ArcGIS Pro | Documentation

under Advanced use of model iterators describes the current state (you can check 2.8 there as well under Other Versions but it only goes back to 2.7) 


... sort of retired...
0 Kudos
圈圈
by
Occasional Contributor

Thanks for your reply. 

I have referred to this page of the help documentation for Pro2.8 in detail and have made sure that my master model and submodel are combined in a way that meets the requirements in the help documentation. 

The whole model works fine in Pro2.5, but not in Pro2.8 or even in Pro2.6.  As I described earlier, in Pro2.8, iterators in the submodel work fine, but iterators in the main model only iterate once and then stop working.  I don't know if this is a known bug and if Pro2.9 has been fixed. 

If possible, I can attach my toolbox and hope to reproduce the error on your computer.  

0 Kudos
DrVSSKiran
Occasional Contributor II

I have created model and submodel in pro  2.8. Iterated the records based on field and i works fine for me. Create another model and check.

圈圈
by
Occasional Contributor

Thank you for your advice.

The iterators in my main model are used to iterate over the element classes in CAD files, and the iterators in my sub-model are used to iterate over the element classes in the file geographic database. Each iterator can iterate multiple times if the two models are run separately, but if submodels are added to the master model and associated, iterators in the master model can only iterate once.

I'll test iterating through other types of files later to see if the main model iterates properly with the addition of submodels.

DanPatterson
MVP Esteemed Contributor

I still can't find any examples of 2 iterators.  I can't even find 2 sub-models with iterators being in a main model.  There are examples of collect values and an iterator.

I will cc @curtvprice to see if he has seen any examples of any models that have incorporated 2 iterators in any sort of variant in recent versions of Pro

This type of situation is better handled by python scripts and scripts associated with tools in ArcToolbox.  Not sure if Modelbuilder is a substitute or a replacement for that functionality.


... sort of retired...
0 Kudos
curtvprice
MVP Esteemed Contributor

Dan, nested looping is supported, but it can be tricky, and you can run afoul of ModelBuilder tool validation (and quirks). You are correct that that these nested workflows are sometimes easier to do by going to Python. Note you can call a model tool from a python script pretty easily so if you can get a good geoprocessing workflow worked out in a model you can write a fairly simple Python driver script to loop on it, and run the script from several entry points, including the command line, Jupyter notebook, script tool, or even as a python function in the Calculate Value tool.

I think if @圈圈  has the exactly same looping working with the older version of software, this is definitely something to take to tech support. I have successfully done nested looping in 2.8.

0 Kudos
圈圈
by
Occasional Contributor

I found that the exception was due to the data type of the iteration. With the addition of submodels, there is no problem with the dataset of the main model iterating through the file geographic database, but the CAD element sets (point, polyline, polygon, etc.) can only be iterated once. Pro2.5 works fine, this problem occurs in Pro2.6 and later, it seems to be a bug.

0 Kudos
alexsunny123
New Contributor

@圈圈 wrote:

I'm building a model and adding a submodel, both of which have an iterator.  When I run the model in Pro2.5, it is fine. But When I run the model in Pro2.8.3, I find that the iterator in the main model only runs once, and the iterator in the submodel runs fine.Is this a known bug about ArcGIS Pro2.8.3?


thanks for the awesome information.

0 Kudos
圈圈
by
Occasional Contributor

I found that the exception was due to the data type of the iteration. With the addition of submodels, there is no problem with the dataset of the main model iterating through the file geographic database, but the CAD element sets (point, polyline, polygon, etc.) can only be iterated once. Pro2.5 works fine, this problem occurs in Pro2.6 and later, it seems to be a bug.

0 Kudos