<?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: use ListFeatureClasses  to provide output names within for: loop in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125875#M49014</link>
    <description>&lt;P&gt;not sure I am following... never, have duplicate names, if that is the case, change something, too many "another" and "test"&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 15:15:28 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-12-14T15:15:28Z</dc:date>
    <item>
      <title>use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124543#M48886</link>
      <description>&lt;P&gt;Thanks for previous help.&amp;nbsp; This question follows on an earlier one that was so helpfully answered.&lt;/P&gt;&lt;P&gt;I've generated a 'ctylist' variable with ListFeatureClasses&lt;/P&gt;&lt;P&gt;I now want to iterate through that list (of counties), and use each county boundary in a sequence of spatial queries and geoprocessing tasks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the final results would be best if they were within a unique feature dataset (one for each county).&lt;/P&gt;&lt;P&gt;I've set up the code snippet below)to create those feature datasets (a set of county feature classes in a gdb created earlier in the script by StripByAttribute) within the for: loop, but can't figure out how to assign the county name to the new feature dataset (the Pro help examples show how to provide a specific name.&lt;/P&gt;&lt;P&gt;I think It would help to create a 'name' variable..and I've seen others suggesting use of a .format. command, but I'm stuck ..&lt;/P&gt;&lt;PRE&gt;ctylist = arcpy.ListFeatureClasses(&lt;SPAN&gt;r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb"&lt;/SPAN&gt;)&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;cty &lt;SPAN&gt;in &lt;/SPAN&gt;ctylist:&lt;BR /&gt;    arcpy.CreateFeatureDataset_management(&lt;SPAN&gt;r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;cty)&lt;BR /&gt;    arcpy.CopyFeatures_management(cty&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb" &lt;/SPAN&gt;+ cty)&lt;/PRE&gt;&lt;P&gt;WIll appreciate any suggestions.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 19:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124543#M48886</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-09T19:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124571#M48889</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;I think the final results would be best if they were within a unique feature dataset (one for each county).&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Are you using feature datasets to organize your data or are you using them as they were designed to be a container of features that have special characteristics or relationships like topology, network datasets, etc?&amp;nbsp; If the former, my suggestion is to rethink that approach as it will eventually cause you headaches.&lt;/P&gt;&lt;P&gt;As far as your for loop is concerned, that's pretty straight forward and if you are using Pro you are using python 3.x so while you can use the format function, I prefer "f-strings":&lt;/P&gt;&lt;LI-CODE lang="python"&gt;countyList = ['Cache', 'Weber', 'Rich', 'Salt Lake']
for name in countyList:
     print(f'Some extra text {name}')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Copy and paste this code into your python ide of choice....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Dec 2021 20:14:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124571#M48889</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-09T20:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124580#M48890</link>
      <description>&lt;LI-CODE lang="python"&gt;import os
gdb = r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb"
ctylist = arcpy.ListFeatureClasses(gdb)
for cty in ctylist:
    out_fc = os.path.join(gdb, cty)
    arcpy.CreateFeatureDataset_management(gdb, cty)
    arcpy.CopyFeatures_management(cty, out_fc)

# or
gdb = r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb"
ctylist = arcpy.ListFeatureClasses(gdb)
for cty in ctylist:
    arcpy.CreateFeatureDataset_management(gdb, cty)
    arcpy.CopyFeatures_management(cty, f"{gdb}\\{cty}")&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 09 Dec 2021 20:25:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1124580#M48890</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-09T20:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125684#M48995</link>
      <description>&lt;P&gt;Thanks for the advice about using feature datasets improperly.&amp;nbsp; For now, it has worked ok for organizing the outputs better but will consider a separate fileGDB for each in the future.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 04:42:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125684#M48995</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-14T04:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125685#M48996</link>
      <description>&lt;P&gt;Thanks Dan.&amp;nbsp; I was arriving at the os.path.join as the solution, but thanks for affirming that approach.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did have to alter it a bit as I wanted to copy the 'cty' into the new Feature Dataset, and that failed unless I used FeatureClass toFeature Class.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;I then tried to add a Delete_management line at the end (after doing some additional geoprocessing within the for: loop, but it deleted all the new data instead of the original 'cty' as I intended.&amp;nbsp; I now see that the Delete_management needs a Data Type specified when you anticipate a naming conflict within the workspace, but I don't find any Help on what the syntax of that Data type parameter should be (e.g. "FeatureClass", "FEATURE_CLASS", or "Feature_Class")...&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 04:48:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125685#M48996</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-14T04:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125774#M49006</link>
      <description>&lt;P&gt;sometimes I forget too&lt;/P&gt;&lt;LI-CODE lang="python"&gt;desc = arcpy.Describe("your featureclass path and name")
if hasattr(desc, "dataType"):
    print("DataType:    " + desc.dataType)&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/describe-object-properties.htm" target="_blank"&gt;Describe object properties—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 11:12:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125774#M49006</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-14T11:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125812#M49010</link>
      <description>&lt;P&gt;Thanks again!&amp;nbsp; BtW, "FeatureClass" is what is returned. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 13:45:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125812#M49010</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-14T13:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125834#M49012</link>
      <description>&lt;P&gt;If you're willing to continue this discussion, and its not 'out of bounds' to morph the post into a related, but different problem....&lt;BR /&gt;If I run the Describe() on a 'ctylist' that was previously created by ListFeatureClasses(mygdb), and that gdb includes both feature datasets and feature classes with the same name (because the former was created from the latter in the previous steps of the script (as per my initial question, and as in the test example pasted below), the print(desc.datatype) only returns the FeatureDatasets (and then when I add a Delete_management(fc) line, only the FeatureDatasets get deleted.&amp;nbsp; I added an if desc.datatType != "FeatureDataset":&amp;nbsp; &amp;nbsp; &amp;nbsp;test, but that does not resolve the issue. The whole script attached below.&lt;/P&gt;&lt;P&gt;Curious, and confused, but not in crisis mode...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PhilCrossley1_0-1639491498126.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29652iD58A08D707C8528C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PhilCrossley1_0-1639491498126.png" alt="PhilCrossley1_0-1639491498126.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 14:28:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125834#M49012</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-14T14:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125875#M49014</link>
      <description>&lt;P&gt;not sure I am following... never, have duplicate names, if that is the case, change something, too many "another" and "test"&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 15:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125875#M49014</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-14T15:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125886#M49016</link>
      <description>&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;...never, have duplicate names...&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;^^^ This...&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 15:21:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125886#M49016</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-14T15:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: use ListFeatureClasses  to provide output names within for: loop</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125897#M49017</link>
      <description>&lt;P&gt;normally, that's my principle also, but in this case I created the feature datasets from the ListFeatureClass() list, and when I tried to change the name of the output so it wouldn't be the same as the input fc, it failed.&amp;nbsp; I'll look again at the os.path.join step and see if i can name the feature datasets differently to start with...&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 15:37:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/use-listfeatureclasses-to-provide-output-names/m-p/1125897#M49017</guid>
      <dc:creator>PhilCrossley1</dc:creator>
      <dc:date>2021-12-14T15:37:33Z</dc:date>
    </item>
  </channel>
</rss>

