<?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>idea Refer to a specific Contents layer — even when there are layers with duplicate names in Python Ideas</title>
    <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idi-p/1373590</link>
    <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;A colleague has built a tool that converts a selection to a definition query.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1706034992019.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92537i99CB4DC663F4BFA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1706034992019.png" alt="Bud_0-1706034992019.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Resulting definition query:&lt;/P&gt;&lt;PRE&gt;t_unique_id IN (122, 123, 124, 125, 126)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tool works well, but it has a limitation: If there are multiple layers in the Contents that have the same name, then the tool has no way to differentiate between the two layers.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Note that since you can only get a layer reference&amp;nbsp;in ArcPy by its name, I had to limit the tool to grabbing the first layer in the Map TOC that has the name [that corresponds to the name] in the tool.&amp;nbsp; So if there are multiple layers or tables with the same name, it will operate on the first one found when looping through them.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In the following example, there are two layers that have the same name, and the second layer is the one that has the selection to be converted to a definition query. When I run the tool, it throws an error because it refers to the first layer, which doesn't have a selection.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1706035557387.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92546i21955282919BC49F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1706035557387.png" alt="Bud_1-1706035557387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As a non-Python person, that seems like an unfortunate limitation of ArcPy, especially since the &lt;EM&gt;Layer or Table&lt;/EM&gt; parameter seems to be aware of the duplicates and refers to them by unique names: "species_records" and "species_records&lt;STRONG&gt;:1&lt;/STRONG&gt;". If the parameter can refer to the duplicate layers by unique names, then is there a reason why the Python script can’t differentiate between the two layers as well?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Idea:&lt;/P&gt;&lt;P&gt;Could ArcPy be enhanced so that it can refer to a specific Contents layer, even if there are multiple layers with duplicate names?&lt;/P&gt;&lt;P&gt;Feel free to let me know if I've misunderstood something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Related:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/selection-to-definition-query/idi-p/932030" target="_self"&gt;Selection to Definition Query&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/contents-unique-layer-names-in-properties-window/idi-p/1374617" target="_self"&gt;&lt;SPAN&gt;Contents — Unique layer names in Properties window (auto-generated)&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Mon, 12 Feb 2024 19:31:46 GMT</pubDate>
    <dc:creator>Bud</dc:creator>
    <dc:date>2024-02-12T19:31:46Z</dc:date>
    <item>
      <title>Refer to a specific Contents layer — even when there are layers with duplicate names</title>
      <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idi-p/1373590</link>
      <description>&lt;P&gt;&lt;EM&gt;ArcGIS Pro 3.2.1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;A colleague has built a tool that converts a selection to a definition query.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1706034992019.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92537i99CB4DC663F4BFA6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1706034992019.png" alt="Bud_0-1706034992019.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Resulting definition query:&lt;/P&gt;&lt;PRE&gt;t_unique_id IN (122, 123, 124, 125, 126)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The tool works well, but it has a limitation: If there are multiple layers in the Contents that have the same name, then the tool has no way to differentiate between the two layers.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Note that since you can only get a layer reference&amp;nbsp;in ArcPy by its name, I had to limit the tool to grabbing the first layer in the Map TOC that has the name [that corresponds to the name] in the tool.&amp;nbsp; So if there are multiple layers or tables with the same name, it will operate on the first one found when looping through them.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In the following example, there are two layers that have the same name, and the second layer is the one that has the selection to be converted to a definition query. When I run the tool, it throws an error because it refers to the first layer, which doesn't have a selection.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1706035557387.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92546i21955282919BC49F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1706035557387.png" alt="Bud_1-1706035557387.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;As a non-Python person, that seems like an unfortunate limitation of ArcPy, especially since the &lt;EM&gt;Layer or Table&lt;/EM&gt; parameter seems to be aware of the duplicates and refers to them by unique names: "species_records" and "species_records&lt;STRONG&gt;:1&lt;/STRONG&gt;". If the parameter can refer to the duplicate layers by unique names, then is there a reason why the Python script can’t differentiate between the two layers as well?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Idea:&lt;/P&gt;&lt;P&gt;Could ArcPy be enhanced so that it can refer to a specific Contents layer, even if there are multiple layers with duplicate names?&lt;/P&gt;&lt;P&gt;Feel free to let me know if I've misunderstood something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Related:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/selection-to-definition-query/idi-p/932030" target="_self"&gt;Selection to Definition Query&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/contents-unique-layer-names-in-properties-window/idi-p/1374617" target="_self"&gt;&lt;SPAN&gt;Contents — Unique layer names in Properties window (auto-generated)&lt;/SPAN&gt;&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 12 Feb 2024 19:31:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idi-p/1373590</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-02-12T19:31:46Z</dc:date>
    </item>
    <item>
      <title>Re: Refer to a specific Contents layer — even when there are layers with duplicate names</title>
      <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1373592#M275</link>
      <description>&lt;P&gt;Tool Requirements:&lt;/P&gt;&lt;DIV&gt;&lt;I&gt;ArcGIS Pro 3.2.1.&amp;nbsp;&lt;/I&gt;&lt;I&gt;When I make a manual selection in the map or attribute table, I want to convert the selection to a definition query.&lt;BR /&gt;For the purpose of manually emailing the layer as a .LYRX file. But creating a .LYRX file wouldn't be part of the tool.&lt;/I&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;OL&gt;&lt;LI&gt;The Toolbox tool would have a pick list that lets me choose a layer from all the feature layers&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;and standalone tables&lt;/STRONG&gt;&amp;nbsp;in the Contents Pane of the map.&lt;/LI&gt;&lt;LI&gt;The selection from that layer would be used, a definition query would be added to that layer, and the existing selection would persist.&lt;/LI&gt;&lt;LI&gt;Create a definition query from the selected records like this: ASSET_ID IN (1,2,3).&lt;/LI&gt;&lt;LI&gt;Has an additional pick list that lets me choose the field I want to use as the definition query SQL expression. For example, ObjectID, ASSET_ID, or a different field with unique values. Only&amp;nbsp;fields with a &lt;STRONG&gt;unique&lt;/STRONG&gt; attribute index in the database would be included in the pick list.&lt;/LI&gt;&lt;LI&gt;Accounts for scenarios where 1) there isn't a selection or 2) there is a&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/indicate-in-the-map-that-a-quot-selection-of-zero/idi-p/1363663" target="_blank" rel="noopener noreferrer noreferrer"&gt;selection of zero records&lt;/A&gt;&lt;SPAN&gt;. I.e., don't create a definition query in either of those cases.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;If there's an existing definition query on the chosen layer, the tool will deactivate the definition query and create a new one.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;STRIKE&gt;Selection2Definition.py&lt;/STRIKE&gt; (old):&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-CODE lang="python"&gt;import arcpy, sys, traceback

SelectionLayer = sys.argv[1]
Field = sys.argv[2]

try:

    ####   Get the current active map
    aprx = arcpy.mp.ArcGISProject("CURRENT")
    map = aprx.listMaps(aprx.activeMap.name)[0]  

    ####  Deal with group layers if needed
    if("\\" in SelectionLayer):
        arySelectionLayer = SelectionLayer.split('\\')
        SelectionLayer = arySelectionLayer[1]

    ### Get the first layer in the TOC with the name selected
    LayersTablesList = map.listLayers(SelectionLayer) + map.listTables(SelectionLayer)
    target_layer = LayersTablesList[0]

    if not target_layer.getSelectionSet():
        raise Exception("No features currently selected.")

    ####   Collect the selected field's features
    lst = []
    with arcpy.da.SearchCursor(target_layer, [Field]) as cursor:
        for row in cursor:
            lst.append(row[0])
            
    ####   Build a where clause
    where = ""
    fieldtype = ""
    fields = arcpy.ListFields(target_layer, Field)
    for field in fields:
         if field.name == Field:
              fieldtype = field.type
   
    ####   single quote if a text field
    if(fieldtype == 'String'):
        where = " IN ('" + "','".join(lst) + "')"
    else:
        where = " IN (" + ",".join([str(i) for i in lst]) + ")"
         
    arcpy.AddMessage(Field + where)

    target_layer.definitionQuery = Field + where

except:
  
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\n  Traceback Info:\n" + tbinfo + "\nError Info:\n    " + \
            str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
    msgs = "arcpy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
    arcpy.AddMessage(pymsg)&lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&lt;STRIKE&gt;Toolvalidator.py&lt;/STRIKE&gt; (old):&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()
        
    def initializeParameters(self):        
        param0 = arcpy.Parameter(
                displayName="Input Features",
                name="in_features",
                datatype=["GPFeatureLayer", "GPTableView"],
                parameterType="Required",
                direction="Input",
                multiValue=False)
                
        param1 = arcpy.Parameter(
                displayName="Select Field",
                name="inputField",
                datatype="Field",
                parameterType="Required",
                direction="Input")
        param1.parameterDependencies = [param0.name]
        param1.filter.list = []    
                        
        params = [param0,param1]   
        return params             

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        if self.params[0].altered:
            layer = self.params[0].value
            if layer:
                # Get all indexes for the layer
                indexes = arcpy.ListIndexes(layer)

                # Create a set of all field names that are part of an index
                indexed_fields = set()
                for index in indexes:
                    if index.isUnique:
                        for field in index.fields:
                            indexed_fields.add(field.name)

                # Filter fields to include only those that have an index
                fields_with_index = [f.name for f in arcpy.ListFields(layer) if f.name in indexed_fields]

                self.params[1].filter.list = fields_with_index
            else:
                self.params[1].filter.list = []
        return

    def updateMessages(self):
        

        # def isLicensed(self):
        #     # set tool isLicensed.
        # return True

        # def postExecute(self):
        #     # This method takes place after outputs are processed and
        #     # added to the display.
        return&lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 19:40:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1373592#M275</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-02-12T19:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Refer to a specific Contents layer — even when there are layers with duplicate names</title>
      <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1376771#M280</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;This tool is explicitly parsing the non-unique string name of the layer out of the input and then using it to search for the layer again using some list functionality.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What is the roadblock that prevents the tool author from directly using the layer passed to the gp tool?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jan 2024 21:38:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1376771#M280</guid>
      <dc:creator>SSWoodward</dc:creator>
      <dc:date>2024-01-31T21:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Refer to a specific Contents layer — even when there are layers with duplicate names</title>
      <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1377195#M281</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/604859"&gt;@SSWoodward&lt;/a&gt;&amp;nbsp;provided a solution here:&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-pro-ideas/contents-unique-layer-names-in-properties-window/idc-p/1377125/highlight/true#M28275" target="_self"&gt;Contents — Unique layer names in Properties window (auto-generated)&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;...try using the&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/getparameter.htm" target="_self" rel="nofollow noopener noreferrer"&gt;arcpy.GetParameter&amp;nbsp;&lt;/A&gt;methods instead of sys.argv. These are super handy, and should be the goto syntax when writing script tools.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the parameter is fetched in this way it is a layer reference and not a string.&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_0-1706813132105.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93468iDF2ADF4133B028FC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bud_0-1706813132105.png" alt="Bud_0-1706813132105.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bud_1-1706813143023.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/93469iE6C08E56F530A59D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Bud_1-1706813143023.png" alt="Bud_1-1706813143023.png" /&gt;&lt;/span&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Updated Python Scripts:&lt;/STRONG&gt;&lt;BR /&gt;(these are the same scripts that are included in the .zip in the original post)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Selection2Definition.py&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-CODE lang="python"&gt;import arcpy, sys, traceback


SelectionLayer = arcpy.GetParameter(0)
Field = sys.argv[2]



try:

    ####   Get the current active map
    aprx = arcpy.mp.ArcGISProject("CURRENT")
    map = aprx.listMaps(aprx.activeMap.name)[0]  

    if not SelectionLayer.getSelectionSet():
        raise Exception("No features currently selected.")

    ####   Collect the selected field's features
    lst = []
    with arcpy.da.SearchCursor(SelectionLayer, [Field]) as cursor:
        for row in cursor:
            lst.append(row[0])
            
    ####   Build a where clause
    where = ""
    fieldtype = ""
    fields = arcpy.ListFields(SelectionLayer, Field)
    for field in fields:
         if field.name == Field:
              fieldtype = field.type
              
    
    ####   single quote if a text field
    if(fieldtype == 'String'):
        where = " IN ('" + "','".join(lst) + "')"
    else:
        where = " IN (" + ",".join([str(i) for i in lst]) + ")"
         
    definition_query = Field + where
    arcpy.AddMessage("DEF: " + definition_query)
    SelectionLayer.definitionQuery = definition_query
    arcpy.SetParameter(2, SelectionLayer)


except:
  
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\n  Traceback Info:\n" + tbinfo + "\nError Info:\n    " + \
            str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
    msgs = "arcpy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
    arcpy.AddMessage(pymsg)
 &lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;Toolvalidator.py&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-CODE lang="python"&gt;class ToolValidator:
  # Class to add custom behavior and properties to the tool and tool parameters.

    def __init__(self):
        # set self.params for use in other function
        self.params = arcpy.GetParameterInfo()
        
    def initializeParameters(self):        
        param0 = arcpy.Parameter(
                displayName="Input Features",
                name="in_features",
                datatype=["GPFeatureLayer", "GPTableView"],
                parameterType="Required",
                direction="Input",
                multiValue=False)
                
        param1 = arcpy.Parameter(
                displayName="Select Field",
                name="inputField",
                datatype="Field",
                parameterType="Required",
                direction="Input")
        param1.parameterDependencies = [param0.name]
        param1.filter.list = []    
                        
        params = [param0,param1]   
        return params             

    def initializeParameters(self):
        # Customize parameter properties. 
        # This gets called when the tool is opened.
        return

    def updateParameters(self):
        # Modify parameter values and properties.
        # This gets called each time a parameter is modified, before 
        # standard validation.
        if self.params[0].altered:
            layer = self.params[0].value
            if layer:
                # Get all indexes for the layer
                indexes = arcpy.ListIndexes(layer)

                # Create a set of all field names that are part of an index
                indexed_fields = set()
                for index in indexes:
                    if index.isUnique:
                        for field in index.fields:
                            indexed_fields.add(field.name)

                # Filter fields to include only those that have an index
                fields_with_index = [f.name for f in arcpy.ListFields(layer) if f.name in indexed_fields]

                self.params[1].filter.list = fields_with_index
            else:
                self.params[1].filter.list = []
        return

    def updateMessages(self):
        

        # def isLicensed(self):
        #     # set tool isLicensed.
        # return True

        # def postExecute(self):
        #     # This method takes place after outputs are processed and
        #     # added to the display.
        return&lt;/LI-CODE&gt;&lt;/LI-SPOILER&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2024 19:46:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1377195#M281</guid>
      <dc:creator>Bud</dc:creator>
      <dc:date>2024-02-12T19:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Refer to a specific Contents layer — even when there are layers with duplicate names - Status changed to: Closed</title>
      <link>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1613359#M463</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/351335"&gt;@Bud&lt;/a&gt;&amp;nbsp;Yea, using the arcpy.GetParameter method rather than sys.argv is recommended. sys.argv is viable, but it doesn't offer arcpy-specific tooling.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Field = sys.argv[2] should also be modified to Field = arcpy.GetParameterAsText(1). If you want the actual field object rather than the string name of the field, use Field = arcpy.GetParameter(1).&lt;/P&gt;&lt;P&gt;Thank you for submitting the idea, I'll close it now since luckily the request is already offered.&lt;/P&gt;</description>
      <pubDate>Fri, 09 May 2025 18:03:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idc-p/1613359#M463</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2025-05-09T18:03:24Z</dc:date>
    </item>
  </channel>
</rss>

