<?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: python toolbox display only the fields that are in both layer in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270746#M67186</link>
    <description>&lt;P&gt;im working with list of list becuse i dont know how many layer the user works with&amp;nbsp;&lt;/P&gt;&lt;P&gt;this woks with the list of list&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = list("abcdefg")

b = list("bcdfghij")

d = [a,b]

set(d[0]).intersection(*d)

{'b', 'c', 'd', 'f', 'g'}&lt;/LI-CODE&gt;&lt;P&gt;or with list of set its that way:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;set.intersection(*d)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Mar 2023 06:43:29 GMT</pubDate>
    <dc:creator>OrrGvili</dc:creator>
    <dc:date>2023-03-23T06:43:29Z</dc:date>
    <item>
      <title>python toolbox display only the fields that are in both layer</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270390#M67166</link>
      <description>&lt;P&gt;&lt;SPAN&gt;i have python tool box&amp;nbsp; with definition query tool, the tool activate definition query on multiple layers&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In running into hard wall when trying to display only the fields that mutual to the different layers&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;When try to display the list of the fields&amp;nbsp; the dialog shows only few fields and not all&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm testing it on 2 similar layers with 90 fields. Turned off 3 in one layer and the dialog show only 4&amp;nbsp; instead of 87&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;With no filter i get all the fields in the first layer&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;how to let the user see only the mutual&amp;nbsp;&lt;/P&gt;&lt;P&gt;list of fileds?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def updateParameters(self, parameters):
        """Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed."""
        if parameters[0].values:
            all_layers_field_list = []
            for layer in parameters[0].values:
                field_names = [f.name for f in arcpy.da.Describe(layer.name)["fields"]]
                all_layers_field_list.append(field_names)

        list_fields = list(set(all_layers_field_list[0]).intersection(*all_layers_field_list[1:]))
        parameters[1].filter.list = list_fields

        if parameters[1].value:
            field_values =list(set([row[0] for row in arcpy.da.SearchCursor(parameters[0].values[0], [parameters[1].valueAsText],f"{parameters[1].valueAsText} IS NOT NULL")]))
            parameters[2].filter.list = field_values             
        return&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 14:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270390#M67166</guid>
      <dc:creator>OrrGvili</dc:creator>
      <dc:date>2023-03-22T14:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: python toolbox display only the fields that are in both layer</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270406#M67169</link>
      <description>&lt;P&gt;I don't know what your *all_layers.... is all about&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = list("abcdefg")

b = list("bcdfghij")

a
['a', 'b', 'c', 'd', 'e', 'f', 'g']

b
['b', 'c', 'd', 'f', 'g', 'h', 'i', 'j']

set(a).intersection(b)
{'b', 'c', 'd', 'f', 'g'}

set(a).intersection(*b)
set()&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Mar 2023 14:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270406#M67169</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-22T14:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: python toolbox display only the fields that are in both layer</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270452#M67174</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;*all_layer_field_list its list containg the list of fields of eace layer&amp;nbsp;&lt;BR /&gt;the intesection works the problem the list of fields in the drop down&amp;nbsp; dont contain the full list&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 15:55:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270452#M67174</guid>
      <dc:creator>OrrGvili</dc:creator>
      <dc:date>2023-03-22T15:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: python toolbox display only the fields that are in both layer</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270465#M67175</link>
      <description>&lt;P&gt;I was pointing out that the starred expression (line 14) yielded erroneous results&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2023 16:10:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270465#M67175</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-03-22T16:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: python toolbox display only the fields that are in both layer</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270746#M67186</link>
      <description>&lt;P&gt;im working with list of list becuse i dont know how many layer the user works with&amp;nbsp;&lt;/P&gt;&lt;P&gt;this woks with the list of list&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;a = list("abcdefg")

b = list("bcdfghij")

d = [a,b]

set(d[0]).intersection(*d)

{'b', 'c', 'd', 'f', 'g'}&lt;/LI-CODE&gt;&lt;P&gt;or with list of set its that way:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;set.intersection(*d)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Mar 2023 06:43:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-display-only-the-fields-that-are-in/m-p/1270746#M67186</guid>
      <dc:creator>OrrGvili</dc:creator>
      <dc:date>2023-03-23T06:43:29Z</dc:date>
    </item>
  </channel>
</rss>

