<?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 Field Parameters: Limit the fields available? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1335605#M68866</link>
    <description>&lt;P&gt;Pretty simple. I have a field parameter, dependent on another parameter.&lt;/P&gt;&lt;P&gt;I want to keep certain fields out of drop-down for this field parameter, e.g. OBJECTID. I don't want it, can't use it for this task, I don't want to see it.&lt;/P&gt;&lt;P&gt;How can I accomplish this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried assigning a filter, but that's not supported on fields, so my current workaround is to use a multivalue string parameter and making the filter be all the fields whose names aren't ObjectID, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 Oct 2023 21:30:52 GMT</pubDate>
    <dc:creator>AlfredBaldenweck</dc:creator>
    <dc:date>2023-10-05T21:30:52Z</dc:date>
    <item>
      <title>Field Parameters: Limit the fields available?</title>
      <link>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1335605#M68866</link>
      <description>&lt;P&gt;Pretty simple. I have a field parameter, dependent on another parameter.&lt;/P&gt;&lt;P&gt;I want to keep certain fields out of drop-down for this field parameter, e.g. OBJECTID. I don't want it, can't use it for this task, I don't want to see it.&lt;/P&gt;&lt;P&gt;How can I accomplish this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried assigning a filter, but that's not supported on fields, so my current workaround is to use a multivalue string parameter and making the filter be all the fields whose names aren't ObjectID, etc.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Oct 2023 21:30:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1335605#M68866</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-10-05T21:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Field Parameters: Limit the fields available?</title>
      <link>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1335713#M68875</link>
      <description>&lt;P&gt;Filters are supported for field parameters, but only for field types.&lt;/P&gt;&lt;P&gt;Field types can be found here:&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/field.htm" target="_blank" rel="noopener"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/field.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example, to only show numerical fields:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def getParameterInfo(self):
    p0 = arcpy.Parameter(name="layer", displayName="Layer", datatype="GPFeatureLayer")
    p1 = arcpy.Parameter(name="field", displayName="Field", datatype="Field"),
    p1.parameterDependencies = ["layer"]
    p1.filter.list = ["integer", "single", "double"]
    return [p0, p1]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sadly doesn't help with excluding specific field names, but maybe it's enough for your use case.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 09:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1335713#M68875</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2023-10-06T09:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Field Parameters: Limit the fields available?</title>
      <link>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1337286#M68946</link>
      <description>&lt;P&gt;Would something like this work?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;p1.filter.list = [f.name for f in arcpy.ListFields(p0.value) if f.name not in ['OBJECTID', '&amp;lt;other undesireable fields&amp;gt;']]&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 12 Oct 2023 14:38:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1337286#M68946</guid>
      <dc:creator>DonMorrison1</dc:creator>
      <dc:date>2023-10-12T14:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Field Parameters: Limit the fields available?</title>
      <link>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1337293#M68947</link>
      <description>&lt;P&gt;That's almost exactly what I ended up doing.&lt;/P&gt;&lt;P&gt;I changed the Field Parameter to a string parameter (since I only needed the names and you can only filter field types), then&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;udFields.filters[0].list = [a.name for a in arcpy.ListFields(inExcel.value)
                                            if a.name.lower() not in 
                                                ["objectid", "globalid", 
                                                "guid", keyField.valueAsText.lower()]]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I should probably add OID in there, too, I guess.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 14:47:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/field-parameters-limit-the-fields-available/m-p/1337293#M68947</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2023-10-12T14:47:22Z</dc:date>
    </item>
  </channel>
</rss>

