<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Bug in Modelbuilder iterators when run as tool in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258954#M8879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats true, but the changes that need to be made are not very major.&amp;nbsp; While it would be best if the bug was addressed, I was merely suggesting this a workaround.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jul 2014 18:15:08 GMT</pubDate>
    <dc:creator>IanMurray</dc:creator>
    <dc:date>2014-07-25T18:15:08Z</dc:date>
    <item>
      <title>Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258951#M8876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just found a bug in 10.2.1 / 10.2.2 that has already been logged but is not fixed. Thankfully it is marked Severe!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;[#NIM103740&amp;nbsp; When a model with an Iterator is run from within the Model editor, it will complete correctly, but overwrites the outputs when run as a tool. ]&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;The issue I ran into is that when you use an iterator output variable in the output name variable (for example %outworkspace%/%name%) it gets set in iteration 1 and 2, but after that it reverts to the value from iteration 1. In my test example, my inputs are pp01.txt, pp02.txt, .. pp05.txt and are read correctly, but the output name variable is set to.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;pp01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;pp02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;pp01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;pp01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;pp01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;This is quite a show stopper.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; font-family: arial, sans-serif;"&gt;The only workaround at this time seems to be to not run the model as a tool.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 17:50:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258951#M8876</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-07-25T17:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258952#M8877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you convert the model to a python script then turn the script into a script tool?&amp;nbsp; That way you would still have an GUI to work with, but it shouldn't run into the same error as running it as a regular tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 17:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258952#M8877</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-07-25T17:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258953#M8878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree ModelBuilder is a really nice environment for putting a workflow together. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, models with iterators do not directly convert and run as exported. In this case, you need to write the arcpy.ListFiles() and set up the loop - ModelBuilder will not do that for you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 18:10:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258953#M8878</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-07-25T18:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258954#M8879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats true, but the changes that need to be made are not very major.&amp;nbsp; While it would be best if the bug was addressed, I was merely suggesting this a workaround.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 18:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258954#M8879</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2014-07-25T18:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258955#M8880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ian.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess users of &lt;A href="https://community.esri.com/group/1218"&gt;Model Builder&lt;/A&gt;‌ should think about upgrading to 10.3 as soon as it is released later in 2014.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update, the bug above has been rejected in favor of this one. According to the URL, this was apparently found at Beta 10.1 and is marked as fixed in 10.3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;[NIM098729 In ArcGIS for Desktop 10.2.1, when running a model with the Iterate Feature tool, an incorrect number of outputs are generated only when running the model as a tool. ]&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Alternate Solution&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;Instead of running the model as tool, use the Edit window. &lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;1. Right-click the model in ArcCatalog. &lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;2. Navigate to Edit &amp;gt; Validate &amp;gt; Run.&lt;/EM&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;EM&gt;&lt;A href="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk4NzI5" title="http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk4NzI5"&gt;http://support.esri.com/en/bugs/nimbus/role/beta10_1/TklNMDk4NzI5&lt;/A&gt;‌&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is how Ian's workaround works (for the good of the thread, and as a training exercise for me on posting pictures and code in GeoNet).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's a picture of my test model. The issue is the value of Output_Name is "%workspace%\%Name%" and the %Name% variable is not getting updated properly for iterations 3..n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="2603" alt="Capture.PNG" class="jive-image image-1" src="https://community.esri.com/legacyfs/online/2603_Capture.PNG" style="width: 620px; height: 213px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here's what gets exported:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14063129176633847 jive_text_macro" jivemacro_uid="_14063129176633847"&gt;
&lt;P&gt;# -*- coding: utf-8 -*-&lt;/P&gt;
&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;# python_iterator_raw.py&lt;/P&gt;
&lt;P&gt;# Created on: 2014-07-25 12:26:57.00000&lt;/P&gt;
&lt;P&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/P&gt;
&lt;P&gt;# Usage: python_iterator_raw &amp;lt;workspace&amp;gt; &amp;lt;ascii&amp;gt; &lt;/P&gt;
&lt;P&gt;# Description: &lt;/P&gt;
&lt;P&gt;# ---------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Import arcpy module&lt;/P&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Load required toolboxes&lt;/P&gt;
&lt;P&gt;arcpy.ImportToolbox("Model Functions")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Script arguments&lt;/P&gt;
&lt;P&gt;workspace = arcpy.GetParameterAsText(0)&lt;/P&gt;
&lt;P&gt;if workspace == '#' or not workspace:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; workspace = "D:\\Users\\cprice\\work\\test" # provide a default value if unspecified&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ascii = arcpy.GetParameterAsText(1)&lt;/P&gt;
&lt;P&gt;if ascii == '#' or not ascii:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ascii = "D:\\Users\\cprice\\work\\Iterator_test\\ascii_rasters" # provide a default value if unspecified&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Local variables:&lt;/P&gt;
&lt;P&gt;File_txt = workspace&lt;/P&gt;
&lt;P&gt;Output_Name = File_txt&lt;/P&gt;
&lt;P&gt;Name = workspace&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Process: Iterate Files&lt;/P&gt;
&lt;P&gt;arcpy.IterateFiles_mb(ascii, "", "txt", "NOT_RECURSIVE")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Process: ASCII to Raster&lt;/P&gt;
&lt;P&gt;arcpy.ASCIIToRaster_conversion(File_txt, Output_Name, "INTEGER")&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here's the working python script I created from the above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14063130434792690 jive_text_macro" jivemacro_uid="_14063130434792690"&gt;
&lt;P&gt;&lt;SPAN style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;"&gt;# -*- coding: utf-8 -*-&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;import os&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;input_folder = arcpy.GetParameterAsText(0)&lt;/P&gt;
&lt;P&gt;output_folder = arcpy.GetParameterAsText(1)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;arcpy.env.workspace = input_folder&lt;/P&gt;
&lt;P&gt;infiles = arcpy.ListFiles("*.txt")&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;for f in infiles:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outraster = os.path.splitext(f)[0] # "file.txt" -&amp;gt; "file")&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="line-height: 1.5;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; outraster = os.path.join(output_folder, outraster) # add output path&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ASCIIToRaster_conversion(f, outraster, "INTEGER")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Created {}".format(outraster))&lt;/P&gt;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jul 2014 18:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258955#M8880</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-07-25T18:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258956#M8881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We took this up with support and there is a hotfix (not a patch) for this problem for 10.2.1. If you are current on support and need this to work I recommend you contact support and request it. The hotfix number is 293414 and the code is: QFE-1021-DT-293414.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are requesting they do a fix that applies to 10.2.2 for people that are going to be stuck at 10.2.x for a while to keep their ArcGIS 3rd party modules in synch.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2014 15:30:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258956#M8881</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-08-14T15:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258957#M8882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have the same issue on 10.2.2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:54:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258957#M8882</guid>
      <dc:creator>BledarBirbo1</dc:creator>
      <dc:date>2015-05-20T08:54:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258958#M8883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You should probably update to 10.3.1 if you can, which is out now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 May 2015 03:30:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/258958#M8883</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-05-21T03:30:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/1002369#M24886</link>
      <description>&lt;P&gt;This same issue seems to be happening&amp;nbsp; in ArcGIS Pro 2.6.3&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 23:53:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/1002369#M24886</guid>
      <dc:creator>Tracy_Maier</dc:creator>
      <dc:date>2020-11-17T23:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Bug in Modelbuilder iterators when run as tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/1153173#M26229</link>
      <description>&lt;P&gt;&amp;nbsp;Same in Pro 2.9.1&lt;/P&gt;</description>
      <pubDate>Sat, 12 Mar 2022 18:07:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/bug-in-modelbuilder-iterators-when-run-as-tool/m-p/1153173#M26229</guid>
      <dc:creator>NoahEnverus</dc:creator>
      <dc:date>2022-03-12T18:07:56Z</dc:date>
    </item>
  </channel>
</rss>

