<?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 Delete Rows in multiple Files in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395464#M13441</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everybody !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i have several Shapefiles containing Points with Values 0 to 4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I`d like to Delete the Point Features with Value '0'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As a manual task, i tried it like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select all '0' by sql request, execute the tool "Delete Rows", done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now i try to automate this Workflow with the Model Builder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a possibility to accomplish this task with the Model Builder at all?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried batching and file lists, but the main problem is SQL Statement of my Selection - how do i tell the sql engine to select the features from &lt;/SPAN&gt;&lt;STRONG&gt;all&lt;/STRONG&gt;&lt;SPAN&gt; input datasets ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am quite new to automation - thanks in advance for any answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Flol&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 May 2012 09:38:16 GMT</pubDate>
    <dc:creator>floLang</dc:creator>
    <dc:date>2012-05-23T09:38:16Z</dc:date>
    <item>
      <title>Delete Rows in multiple Files</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395464#M13441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello everybody !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i have several Shapefiles containing Points with Values 0 to 4.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I`d like to Delete the Point Features with Value '0'.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As a manual task, i tried it like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Select all '0' by sql request, execute the tool "Delete Rows", done.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now i try to automate this Workflow with the Model Builder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a possibility to accomplish this task with the Model Builder at all?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried batching and file lists, but the main problem is SQL Statement of my Selection - how do i tell the sql engine to select the features from &lt;/SPAN&gt;&lt;STRONG&gt;all&lt;/STRONG&gt;&lt;SPAN&gt; input datasets ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am quite new to automation - thanks in advance for any answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with best regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Flol&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 09:38:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395464#M13441</guid>
      <dc:creator>floLang</dc:creator>
      <dc:date>2012-05-23T09:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Rows in multiple Files</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395465#M13442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Flo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You'll want to use an &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000001w000000"&gt;iterator&lt;/A&gt;&lt;SPAN&gt; to cycle through all of the shapefiles within a particular folder.&amp;nbsp; It will then apply all downstream processes (Select by Attribute and Delete Rows) to each input shapefile.&amp;nbsp; Hopefully you're using v10.0, as doing this prior to that version will prove tricky using only model builder.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Specifically, you'll want to use the &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00400000000v000000.htm"&gt;Iterate Files tool&lt;/A&gt;&lt;SPAN&gt; for your shapefiles.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 May 2012 18:05:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395465#M13442</guid>
      <dc:creator>TimHopper</dc:creator>
      <dc:date>2012-05-23T18:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Rows in multiple Files</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395466#M13443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The key is not to "select the features from &lt;/SPAN&gt;&lt;STRONG&gt;all &lt;/STRONG&gt;&lt;SPAN&gt;input datasets", but rather to select the features from &lt;/SPAN&gt;&lt;STRONG&gt;each &lt;/STRONG&gt;&lt;SPAN&gt;of the input datasets.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;A simple script should handle looping through a list of shapefiles.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Build the list either with ListFeatureClasses or manually, and itterate it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Feed the sql query into MakeFeatureLayer to select the proper (doomed) features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Feed the resulting layer to DeleteFeatures (rather than DeleteRows)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Loop around again for the next shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Itteration is possible in Model Builder, but cleaner and more reliable in a python script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One way of approaching it is that you can build a model that runs 'once through' just one shapefile, then export the model to a script and wrap the basic code in a loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It may look sorta like this:&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
arcpy.env.workspace = r"c:\WhereTheShapesfileLive"
thelist_of_shapefiles = arcpy.ListFeatureClasses('*')
sqlBit = '"Value" = 0'
for each in thelist_of_shapefiles: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = each[:-4] + "Layer"
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management (each, layer, sqlBit)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.DeleteFeatures_management(layer)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395466#M13443</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2021-12-11T18:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Rows in multiple Files</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395467#M13444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello rthopper and mdenil !&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your answers ! sadly i am still working with 9.3.1 -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;the Python Script is a very good idea, ill try to code my process completely in Python now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; thank you both very much !&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 May 2012 06:25:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395467#M13444</guid>
      <dc:creator>floLang</dc:creator>
      <dc:date>2012-05-24T06:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Delete Rows in multiple Files</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395468#M13445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There is nothing in the script that would not work in 9.3.1 with a 9.3 geoprocessor object instead of arcpy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcgisscripting
gp = arcgisscripting(9.3)
gp.workspace = r"c:\WhereTheShapefilesLive"
thelist_of_shapefiles = gp.ListFeatureClasses('*')
sqlBit = '"Value" = 0'
for each in thelist_of_shapefiles: 
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = each[:-4] + "Layer"&amp;nbsp; # slices off the '.shp' part of the name and adds suffix 'Layer'
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.MakeFeatureLayer_management (each, layer, sqlBit)
&amp;nbsp;&amp;nbsp;&amp;nbsp; gp.DeleteFeatures_management(layer)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:06:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/delete-rows-in-multiple-files/m-p/395468#M13445</guid>
      <dc:creator>markdenil</dc:creator>
      <dc:date>2021-12-11T18:06:21Z</dc:date>
    </item>
  </channel>
</rss>

