<?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: Different output from an ArcGIS Model depending on whether the model is run within model builder itself or through the toolbox dialog?  in ModelBuilder Questions</title>
    <link>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861364#M1556</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Curtis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output location is a parameter but not the individual feature classes. My problem is not that they aren't deleted, but that for some reason when I run from the toolbox dialog the tool deletes too many feature classes regardless of if they are empty or not - when I run it within the model builder window it performs correctly. Here's a look at the code of one of the methods I've tried. I have this run at the end of the model using the output folder parameter as the input workspace with creation of the feature classes as preconditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Delete Empty Feature Classes in User Specified Workspace - Python Script&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Written By: Neal Banerjee, January 2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Import Python Modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;import arcgisscripting&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#Create the geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp = arcgisscripting.create(9.3)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Set Workspace to list feature classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#gp.workspace = "C:/temp/kme1.mdb/fdkme"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#Get Input Workspace as Argument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.workspace = gp.GetParameterAsText(0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Get List of Feature Classes in Workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;lstFCs = gp.ListFeatureClasses()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "--------------------------------------------------"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#gp.AddMessage("--------------------------------------------------")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;for fc in lstFCs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print "Processing " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage("Processing " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; recCnt = int(gp.GetCount_management(fc).GetOutput(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; if recCnt == 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print "Empty - Deleting " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage("Empty - Deleting " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.Delete_management(fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print str(recCnt) + " Records - Keeping " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage(str(recCnt) + " Records - Keeping " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "--------------------------------------------------"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("--------------------------------------------------")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("\n")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2018 17:11:15 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2018-10-11T17:11:15Z</dc:date>
    <item>
      <title>Different output from an ArcGIS Model depending on whether the model is run within model builder itself or through the toolbox dialog?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861362#M1554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;I wan't to create a model where at the end any empty outputs are automatically deleted. To do this I've tried a few things, mainly wi&lt;/SPAN&gt;&lt;SPAN&gt;th python&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;either&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;through an embedded script tool or though python code in a calculate value tool. Everything seems to work fine when I run the model within model builder (Model &amp;gt; Run Entire Model), but as soon as I close the model and try running it through the dialog box (Toolbox &amp;gt; Double click on the model) way more feature classes are deleted then should be. I've been using a get count function where the input feature class is deleted if the number of features is 0. Can anyone think of why the results might be so different?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2018 22:27:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861362#M1554</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-10-10T22:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Different output from an ArcGIS Model depending on whether the model is run within model builder itself or through the toolbox dialog?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861363#M1555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are the output feature classes you are trying to delete output parameters? If so this makes sense to me that this would not be doable when running with a tool as outputs run as tools have layer objects generated (ie added to map) so file locking will not let you do that!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 04:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861363#M1555</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2018-10-11T04:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Different output from an ArcGIS Model depending on whether the model is run within model builder itself or through the toolbox dialog?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861364#M1556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Curtis,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The output location is a parameter but not the individual feature classes. My problem is not that they aren't deleted, but that for some reason when I run from the toolbox dialog the tool deletes too many feature classes regardless of if they are empty or not - when I run it within the model builder window it performs correctly. Here's a look at the code of one of the methods I've tried. I have this run at the end of the model using the output folder parameter as the input workspace with creation of the feature classes as preconditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Delete Empty Feature Classes in User Specified Workspace - Python Script&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Written By: Neal Banerjee, January 2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Import Python Modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;import arcgisscripting&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#Create the geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp = arcgisscripting.create(9.3)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Set Workspace to list feature classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#gp.workspace = "C:/temp/kme1.mdb/fdkme"&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#Get Input Workspace as Argument&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.workspace = gp.GetParameterAsText(0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;# Get List of Feature Classes in Workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;lstFCs = gp.ListFeatureClasses()&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px; text-align: left;"&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("\n")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "--------------------------------------------------"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;#gp.AddMessage("--------------------------------------------------")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;for fc in lstFCs:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print "Processing " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage("Processing " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; recCnt = int(gp.GetCount_management(fc).GetOutput(0))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; if recCnt == 0:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print "Empty - Deleting " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage("Empty - Deleting " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.Delete_management(fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; print str(recCnt) + " Records - Keeping " + fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt; gp.AddMessage(str(recCnt) + " Records - Keeping " + fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "--------------------------------------------------"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("--------------------------------------------------")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;print "\n"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'andale mono', monospace;"&gt;gp.AddMessage("\n")&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2018 17:11:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861364#M1556</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-10-11T17:11:15Z</dc:date>
    </item>
    <item>
      <title>Re: Different output from an ArcGIS Model depending on whether the model is run within model builder itself or through the toolbox dialog?</title>
      <link>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861365#M1557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have the required preconditions set so your Calculate Value run (or embedded script) is forced to run last?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Oct 2018 04:43:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/modelbuilder-questions/different-output-from-an-arcgis-model-depending-on/m-p/861365#M1557</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2018-10-16T04:43:50Z</dc:date>
    </item>
  </channel>
</rss>

