<?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: How to use lists in MakeFeatureLayer tool? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251883#M64651</link>
    <description>&lt;P&gt;Glad it worked.&amp;nbsp; Pretty standard to append the _lyr to the end.&amp;nbsp; That way, when feeding the output into another tool/process, is easier to distinguish the layer from the original FC.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2023 15:20:50 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2023-01-26T15:20:50Z</dc:date>
    <item>
      <title>How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251487#M64611</link>
      <description>&lt;P&gt;I'm using ListFeatureClasses to list all the layers in the GDB that I created and added layers to from a previous step. I then create another list and split the "\\" out and am left with a list of serials that I want. But when I add the two lists to the MakeFeatureLayer tool I get an error?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;arcpy.env.workspace = r'\\FilePath\Tracks.gdb'
GDB = arcpy.env.workspace

full_fcs = []
for fc in arcpy.ListFeatureClasses():
    full_fcs.append(os.path.join(GDB,fc))
print(full_fcs)

serials = []
for i in full_fcs:
    serials.append(i.split("\\")[-1])
print(serials)
['T07JDD9C00100DP', 'T095XH6K002006B', 'T0K1CF8W3AH5FKP', 'T1WNBH3K00201QB', 'T3N3BHBA012024T', 'T3NZCJ9L0146GRK', 'T3NZSHAP00304LW']
arcpy.management.MakeFeatureLayer(full_fcs, serials)
Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9395, in MakeFeatureLayer
    raise e
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9392, in MakeFeatureLayer
    retval = convertArcObjectToPythonObject(gp.MakeFeatureLayer_management(*gp_fixargs((in_features, out_layer, where_clause, workspace, field_info), True)))
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in &amp;lt;lambda&amp;gt;
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 18:49:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251487#M64611</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-25T18:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251535#M64617</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The tool expects you to input a single path and a single layer name. So you have to do it in a loop:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;for path, name in zip(full_fcs, serials):
    arcpy.management.MakeFeatureLayer(path, name)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 25 Jan 2023 19:40:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251535#M64617</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-01-25T19:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251536#M64618</link>
      <description>&lt;P&gt;Since trying to make feature layer, I assume the 'serials' are the names of the feature classes in the FGDB?&lt;/P&gt;&lt;P&gt;Looks like you are trying to make a feature layer for all the feature classes in the database.&lt;/P&gt;&lt;P&gt;Since the workspace is set, no need to split them up, just interate through the listfeatures and feed to the make features:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;GDB = arcpy.env.workspace = r'\\FilePath\Tracks.gdb'

for fc in arcpy.ListFeatureClasses():
    arcpy.MakeFeatureLayer_management(fc, f"{fc}_lyr")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 19:45:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251536#M64618</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-01-25T19:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251808#M64638</link>
      <description>&lt;P&gt;This worked thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 11:12:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251808#M64638</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-26T11:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251809#M64639</link>
      <description>&lt;P&gt;This worked! Although the f"{fc}_lyr" added _lyr to the end of every layer it brought over. Removing the "_lyr" fixed it and gave me the output I was looking for.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 11:14:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251809#M64639</guid>
      <dc:creator>Davec43</dc:creator>
      <dc:date>2023-01-26T11:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lists in MakeFeatureLayer tool?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251883#M64651</link>
      <description>&lt;P&gt;Glad it worked.&amp;nbsp; Pretty standard to append the _lyr to the end.&amp;nbsp; That way, when feeding the output into another tool/process, is easier to distinguish the layer from the original FC.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2023 15:20:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-use-lists-in-makefeaturelayer-tool/m-p/1251883#M64651</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2023-01-26T15:20:50Z</dc:date>
    </item>
  </channel>
</rss>

