<?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 Using iterations in modelbuilder in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433850#M34091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I couldn't really figure out in which forum to ask this, so I'll try here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically I need to run a model from modelbuilder 20 times where the final output of each run is used as the starting input in the next run. I've should either use the while or for iteration I guess, but I can't really figure out how to implement them in the model.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Aug 2012 21:43:20 GMT</pubDate>
    <dc:creator>PeterThomsen</dc:creator>
    <dc:date>2012-08-12T21:43:20Z</dc:date>
    <item>
      <title>Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433850#M34091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I couldn't really figure out in which forum to ask this, so I'll try here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically I need to run a model from modelbuilder 20 times where the final output of each run is used as the starting input in the next run. I've should either use the while or for iteration I guess, but I can't really figure out how to implement them in the model.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Aug 2012 21:43:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433850#M34091</guid>
      <dc:creator>PeterThomsen</dc:creator>
      <dc:date>2012-08-12T21:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433851#M34092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What is it you are trying to do? Can you provide some more detail?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Aug 2012 22:20:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433851#M34092</guid>
      <dc:creator>SolomonPulapkura</dc:creator>
      <dc:date>2012-08-12T22:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433852#M34093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, if you can describe the problem more specifically, that would be great.&amp;nbsp; Have you looked at the help section?&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000001n000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000001n000000.htm&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 00:22:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433852#M34093</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2012-08-13T00:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433853#M34094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, well I have built a simple model that describes the expansion of a city in a year from two parameters, as seen in the image.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16869[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The trick is that I need to make the model calculate how the city will expand through 20 years, meaning that the output of the first run needs to be the input of the next run, as the expansion of the city in year 1 should be taken into consideration when the expansion for year 2 is being calculated and so forth.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 00:32:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433853#M34094</guid>
      <dc:creator>PeterThomsen</dc:creator>
      <dc:date>2012-08-13T00:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433854#M34095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How about trying the "For" iterator, as described in the documentation link.&amp;nbsp; It seems like it would work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set the From Value To 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set the To Value to 20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Set the By value to 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You would want to tie the numeric value of each iteration to the raw path of the input file (starting with a pre-named "your path\map1.asc") using inline Variable substitution.&amp;nbsp; The model should dynamically draw the file by its full path, not as a fixed feature layer.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You would then tell the model to name the output file with the numeric value of the iteration + 1, (yourpath\map2.asc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On the following iteration, the input file would be the previous iteration's output file (yourpath\map2.asc) and the output file would be (yourpath\map3.asc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This would repeat itself 20 times, with (yourpath\map21.asc) being the desired output.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully these ideas help.&amp;nbsp; I'm more familiar with python scripting.&amp;nbsp; With modelbuilder, sometimes doing what you think should be a simple task can turn out to be a real headache.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 01:50:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433854#M34095</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2012-08-13T01:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433855#M34096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been trying to do something similar, though the "iteration +1" part didn't seem to work, but that is probably just me not knowing the exact way to write the command in modelbuilder. "Iteration +1" did also seem to cause problems in the raster calculators, as the tool could not recognize the layer, but again that is probably because I have written the "iteration +1" command wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like I wasn't too far off. Now I just need to figure out how to write the command properly. I will give it another shot.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 03:14:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433855#M34096</guid>
      <dc:creator>PeterThomsen</dc:creator>
      <dc:date>2012-08-13T03:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433856#M34097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried once more, and I got a basic "for" function to work, though I am still not able to add the iteration number by one. At the moment i write "map%value+1%" which does not seem to work. Furthermore Raster Calculator apparently does not like to use layers in the calculation that includes %value%, so I do not really know what to do.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 03:37:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433856#M34097</guid>
      <dc:creator>PeterThomsen</dc:creator>
      <dc:date>2012-08-13T03:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433857#M34098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried messing with the for loop model iterator as well, and it seems you can't pass a dynamic file path to a geoprocessing tool, because the "file path doesn't exist".&amp;nbsp; Can you export your model to python script and post on the forum?&amp;nbsp; You can do this with the model open by going to Model &amp;gt; Export &amp;gt; To Python Script.&amp;nbsp;&amp;nbsp; It would probably be a snap to add in the iteration number to the file path name and draw that into the process.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you do end up posting it, can you include the raw file path of map.asc?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, what is the output of the raster calculator tool?&amp;nbsp; If it is a new .asc file then you should be in business.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 12:15:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433857#M34098</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2012-08-13T12:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433858#M34099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is a property on a variable you specify in model builder called the Feedback variable - I think this is what you want to use.&amp;nbsp; I haven't made use of this myself but from the help it sounds like this is the direction you want to go.. take a look here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w00000065000000" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w00000065000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you find a solution, post what it was as this is an interesting problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Aug 2012 12:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433858#M34099</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-08-13T12:30:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433859#M34100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;There is a property on a variable you specify in model builder called the Feedback variable - I think this is what you want to use. I haven't made use of this myself but from the help it sounds like this is the direction you want to go.. take a look here:&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the link clthompson.&amp;nbsp; This looks like exactly what we need.&amp;nbsp; Many thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Aug 2012 16:42:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433859#M34100</guid>
      <dc:creator>BruceBacia</dc:creator>
      <dc:date>2012-08-14T16:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: Using iterations in modelbuilder</title>
      <link>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433860#M34101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That feedback function was just what I needed. The only thing I had to change in my original model was to add the feedback line. The model ended up looking like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]16994[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I now get a map for each year, and the original input file uses the previous output as feedback, just as I wanted. Thanks a lot &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2012 04:54:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-iterations-in-modelbuilder/m-p/433860#M34101</guid>
      <dc:creator>PeterThomsen</dc:creator>
      <dc:date>2012-08-16T04:54:05Z</dc:date>
    </item>
  </channel>
</rss>

