<?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 Python Script Running in Model Builder before another Operation Starts in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830288#M3564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a built a rather large Model in Model Builder that process several&lt;BR /&gt;million records.&amp;nbsp; Part of the model includes running an update cursor&lt;BR /&gt;script before it does a Dissolve on that dataset.&amp;nbsp; I have gotten the&lt;BR /&gt;python script run, but not in the right order.&amp;nbsp; In fact, it only runs at&lt;BR /&gt;the very end of the whole model.&amp;nbsp; As I am new to Model Builder, I cannot&lt;BR /&gt;figure out how to get it to run in the proper order, before the Dissolve&lt;BR /&gt;process and not at the very end of the whole model.&amp;nbsp; Thanks for your&lt;BR /&gt;help in advance!!&amp;nbsp; &lt;/P&gt;&lt;P&gt;I am running ArcGIS 10.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Sep 2015 19:09:22 GMT</pubDate>
    <dc:creator>ClintonCooper1</dc:creator>
    <dc:date>2015-09-14T19:09:22Z</dc:date>
    <item>
      <title>Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830288#M3564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a built a rather large Model in Model Builder that process several&lt;BR /&gt;million records.&amp;nbsp; Part of the model includes running an update cursor&lt;BR /&gt;script before it does a Dissolve on that dataset.&amp;nbsp; I have gotten the&lt;BR /&gt;python script run, but not in the right order.&amp;nbsp; In fact, it only runs at&lt;BR /&gt;the very end of the whole model.&amp;nbsp; As I am new to Model Builder, I cannot&lt;BR /&gt;figure out how to get it to run in the proper order, before the Dissolve&lt;BR /&gt;process and not at the very end of the whole model.&amp;nbsp; Thanks for your&lt;BR /&gt;help in advance!!&amp;nbsp; &lt;/P&gt;&lt;P&gt;I am running ArcGIS 10.3&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:09:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830288#M3564</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-14T19:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830289#M3565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try setting your preconditions. &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/modelbuilder/a-quick-tour-of-using-precondition.htm" title="http://desktop.arcgis.com/en/desktop/latest/analyze/modelbuilder/a-quick-tour-of-using-precondition.htm"&gt;A quick tour of using preconditions—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830289#M3565</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-09-14T19:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830290#M3566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks/&amp;nbsp; When I try t set the precondition, I get a pop up that says:&amp;nbsp; Can only Connect a Variable to a Process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The script is just a .py file that I have imported into my toolbox.&amp;nbsp; Do I need to set up anything within that text file to get it to be set as a precondition?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:25:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830290#M3566</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-14T19:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830291#M3567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does your script have any input output variables you could then set the precondition of the process following the script to wait for the script.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:31:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830291#M3567</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-09-14T19:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830292#M3568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It does not.&amp;nbsp; It just simply runs an update cursor calculation on a dataset updating a bunch of fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is my script:&lt;/P&gt;&lt;P&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/P&gt;&lt;P&gt;import arcpy, collections&lt;BR /&gt;fc = r"E:\MATCH_WARD"&lt;/P&gt;&lt;P&gt;fields = ('AMOUNT','PARTY_IDEOLOGY','UNK','REP','DEM','CONT_DEM_NUM','CONT_REP_NUM','CONT_UNK_NUM')&lt;/P&gt;&lt;P&gt;with arcpy.da.UpdateCursor(fc, fields) as cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; for row in cursor:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == "UNK":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2]=row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[7]=1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[2]=0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[7]=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == "REP":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[3]=row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[6]=1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[3]=0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[6]=0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[1] == "DEM":&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[4]=row[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[5]=1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[4]=0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[5]=0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row)&lt;BR /&gt;del row&lt;BR /&gt;del cursor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:35:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830292#M3568</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-14T19:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830293#M3569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You may have to export your model to python and put your update cursor script in, where you need it to go or change your script to have a dummy output that you could use for preconditions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830293#M3569</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-09-14T19:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830294#M3570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you give an example of what a dummy ouput would look like and how to connect the script to the dummy ouput and then to the next process in Model builder?&amp;nbsp; Thanks again!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 19:50:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830294#M3570</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-14T19:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830295#M3571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add&amp;nbsp; this code to your script in your tool set a variable as derived and as text&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
dvariable = "Dummy"
arcpy.SetParameterAsText(0,dvariable)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:01:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830295#M3571</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2021-12-12T10:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830296#M3572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much for your help and patience with me!&amp;nbsp; I fully understand about adding the text within my script and all that, my trouble is understanding what I need to do in model builder.&amp;nbsp; Can you give a bit more detailed instruction for what I need to do within model builder such as setting a variable as derived and as text?&amp;nbsp; thanks !!!!!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 20:08:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830296#M3572</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-14T20:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830297#M3573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Once you've added the code to your script you'll need to fix your tool to show your changes. Right click your tool in catalog and select properties then set your tool like below you may need to remove and reload into your model&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/126807_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Sep 2015 20:29:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830297#M3573</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2015-09-14T20:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Python Script Running in Model Builder before another Operation Starts</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830298#M3574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THAT WORKED PERFECTLY, THANK YOU SO MUCH!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Sep 2015 00:20:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/python-script-running-in-model-builder-before/m-p/830298#M3574</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2015-09-15T00:20:48Z</dc:date>
    </item>
  </channel>
</rss>

