<?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: Model Builder: Calculate Statistics for whole dataset and export into a single ta in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368090#M12671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Alexander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a script that will perform this functionality.&amp;nbsp; The script will iterate through each feature class in a geodatabase.&amp;nbsp; For the first feature class it will output the Frequency to a table called 'Report'.&amp;nbsp; Next, it adds a field ('FC_Name') to store the feature class name.&amp;nbsp; After the first feature class the script creates a table in memory of the frequency and then appends it to the table created previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\temp\python\test.gdb"&amp;nbsp; firstTime = True&amp;nbsp; for fc in arcpy.ListFeatureClasses("*"): &amp;nbsp;&amp;nbsp;&amp;nbsp; if firstTime: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Frequency_analysis(fc, "Report", "created_user;last_edited_user") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management("Report", "FC_Name", "TEXT", "", "", 200) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Report", ["FC_NAME"]) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = str(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, cursor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstTime = False &amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Frequency_analysis(fc, r"IN_MEMORY\Report", "created_user;last_edited_user") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(r"IN_MEMORY\Report", "FC_Name", "TEXT", "", "", 200) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(r"IN_MEMORY\Report", ["FC_NAME"]) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = str(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(r"IN_MEMORY\Report", "Report", "TEST")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, cursor&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jun 2014 10:00:33 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2014-06-24T10:00:33Z</dc:date>
    <item>
      <title>Model Builder: Calculate Statistics for whole dataset and export into a single table.</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368089#M12670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good morning,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My goal here is to use the iterate tool and have the model run through each feature class(about 60+ feature classes) within a dataset, calculate the frequency/count of a ModifiedBy field &amp;amp; CreatedBy field and have the output be a single pivot table that is sortable by feature class, Modified By user &amp;amp; Created By user. I also need to it add the name of the feature class it pulled the statistics from.&amp;nbsp; We want to use this on a monthly basis to see how often people are updating each feature class. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am running into issues with the interate tool over writing my statistics output table from the feature class before it. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;so I need it to almost append the new values it created to a new table before it overwrites it and moves on to the next feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be great.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2014 14:13:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368089#M12670</guid>
      <dc:creator>ashubra</dc:creator>
      <dc:date>2014-06-23T14:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder: Calculate Statistics for whole dataset and export into a single ta</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368090#M12671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Alexander,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a script that will perform this functionality.&amp;nbsp; The script will iterate through each feature class in a geodatabase.&amp;nbsp; For the first feature class it will output the Frequency to a table called 'Report'.&amp;nbsp; Next, it adds a field ('FC_Name') to store the feature class name.&amp;nbsp; After the first feature class the script creates a table in memory of the frequency and then appends it to the table created previously.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env env.overwriteOutput = 1 env.workspace = r"C:\temp\python\test.gdb"&amp;nbsp; firstTime = True&amp;nbsp; for fc in arcpy.ListFeatureClasses("*"): &amp;nbsp;&amp;nbsp;&amp;nbsp; if firstTime: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Frequency_analysis(fc, "Report", "created_user;last_edited_user") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management("Report", "FC_Name", "TEXT", "", "", 200) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor("Report", ["FC_NAME"]) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = str(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, cursor &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; firstTime = False &amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Frequency_analysis(fc, r"IN_MEMORY\Report", "created_user;last_edited_user") &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(r"IN_MEMORY\Report", "FC_Name", "TEXT", "", "", 200) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(r"IN_MEMORY\Report", ["FC_NAME"]) as cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in cursor: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[0] = str(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management(r"IN_MEMORY\Report", "Report", "TEST")&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; del row, cursor&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2014 10:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368090#M12671</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-06-24T10:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Model Builder: Calculate Statistics for whole dataset and export into a single ta</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368091#M12672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 17:29:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/model-builder-calculate-statistics-for-whole/m-p/368091#M12672</guid>
      <dc:creator>ashubra</dc:creator>
      <dc:date>2014-06-26T17:29:51Z</dc:date>
    </item>
  </channel>
</rss>

