<?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 Python Toolbox Parameter Question in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-toolbox-parameter-question/m-p/1104234#M62578</link>
    <description>&lt;P&gt;Hello, I want to specify an input for each column of the 'field compare' parameter, so it would be 'baseFeatures' would link just to the 'Base Fields' column and 'updatedFeatures' would just link to the 'Updated Fields' column. This is basically what 'Compare Fields' do in the 'Detect Feature Changes' tool.&lt;/P&gt;&lt;P&gt;This is what I did.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Compare Features"
        self.description = "Compare the features from two datasets (a base one and an updated one)" + \
                           "and returns the desired outputs."
        self.canRunInBackground = False

    def getParameterInfo(self):
        """Define parameter definitions"""
        baseFeatures = arcpy.Parameter(displayName="Input Base Features", name="base_Features", datatype="GPFeatureLayer", parameterType="Required", direction="Input")

        updatedFeatures = arcpy.Parameter(displayName="Input Updated Features", name="updated_Features", datatype="GPFeatureLayer", parameterType="Required", direction="Input")

        linearUnit = arcpy.Parameter(displayName="Search Distance", name="search_distance", datatype="GPLinearUnit", parameterType="Required", direction="Input")

        fieldCompare = arcpy.Parameter(displayName="Compare Fields", name="compareFields", datatype="GPValueTable", parameterType="Optional", direction="Input")
        paramNames = [baseFeatures.name, updatedFeatures.name]
        fieldCompare.parameterDependencies = paramNames
        fieldCompare.columns = [['Field', 'Base Fields'], ['Field', 'Updated Fields']]

        geometryOutput = arcpy.Parameter(displayName="Geometry Changes Output", name="newandnochange_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        attributeChangeOutput = arcpy.Parameter(displayName="Attribute Changes Output", name="attributechanges_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        delAndNewOutput = arcpy.Parameter(displayName="Deleted/New Features", name="delandnew_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        params = [baseFeatures, updatedFeatures, linearUnit, fieldCompare, geometryOutput, attributeChangeOutput ,delAndNewOutput]

        return params&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that with parameter dependencies I could specify two names, instead it only takes into account the first name I choose in the dependencies list (if Ihave 'baseFeatures.name' first both columns will only have the baseFeatures columns / if I have 'updatedFeatures.name' first it will only have the updatedFeature columns), and I can't "link" one parameter with the desired cloumn.&lt;/P&gt;&lt;P&gt;Does anyone know what am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 Oct 2021 10:38:51 GMT</pubDate>
    <dc:creator>PedroMiguelBispoRosa</dc:creator>
    <dc:date>2021-10-03T10:38:51Z</dc:date>
    <item>
      <title>Python Toolbox Parameter Question</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-parameter-question/m-p/1104234#M62578</link>
      <description>&lt;P&gt;Hello, I want to specify an input for each column of the 'field compare' parameter, so it would be 'baseFeatures' would link just to the 'Base Fields' column and 'updatedFeatures' would just link to the 'Updated Fields' column. This is basically what 'Compare Fields' do in the 'Detect Feature Changes' tool.&lt;/P&gt;&lt;P&gt;This is what I did.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;class Tool(object):
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Compare Features"
        self.description = "Compare the features from two datasets (a base one and an updated one)" + \
                           "and returns the desired outputs."
        self.canRunInBackground = False

    def getParameterInfo(self):
        """Define parameter definitions"""
        baseFeatures = arcpy.Parameter(displayName="Input Base Features", name="base_Features", datatype="GPFeatureLayer", parameterType="Required", direction="Input")

        updatedFeatures = arcpy.Parameter(displayName="Input Updated Features", name="updated_Features", datatype="GPFeatureLayer", parameterType="Required", direction="Input")

        linearUnit = arcpy.Parameter(displayName="Search Distance", name="search_distance", datatype="GPLinearUnit", parameterType="Required", direction="Input")

        fieldCompare = arcpy.Parameter(displayName="Compare Fields", name="compareFields", datatype="GPValueTable", parameterType="Optional", direction="Input")
        paramNames = [baseFeatures.name, updatedFeatures.name]
        fieldCompare.parameterDependencies = paramNames
        fieldCompare.columns = [['Field', 'Base Fields'], ['Field', 'Updated Fields']]

        geometryOutput = arcpy.Parameter(displayName="Geometry Changes Output", name="newandnochange_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        attributeChangeOutput = arcpy.Parameter(displayName="Attribute Changes Output", name="attributechanges_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        delAndNewOutput = arcpy.Parameter(displayName="Deleted/New Features", name="delandnew_Features", datatype="GPBoolean", parameterType="Optional", direction="Input")

        params = [baseFeatures, updatedFeatures, linearUnit, fieldCompare, geometryOutput, attributeChangeOutput ,delAndNewOutput]

        return params&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that with parameter dependencies I could specify two names, instead it only takes into account the first name I choose in the dependencies list (if Ihave 'baseFeatures.name' first both columns will only have the baseFeatures columns / if I have 'updatedFeatures.name' first it will only have the updatedFeature columns), and I can't "link" one parameter with the desired cloumn.&lt;/P&gt;&lt;P&gt;Does anyone know what am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 Oct 2021 10:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-parameter-question/m-p/1104234#M62578</guid>
      <dc:creator>PedroMiguelBispoRosa</dc:creator>
      <dc:date>2021-10-03T10:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python Toolbox Parameter Question</title>
      <link>https://community.esri.com/t5/python-questions/python-toolbox-parameter-question/m-p/1106113#M62602</link>
      <description>&lt;P&gt;You can get info about the tool properties by right clicking a tool and select Properties, then go to the Parameters page.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Detect Feature Changes tool uses a value table parameter with two string columns.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DrewFlater_1-1633723470962.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24886i880ED9B07295E579/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DrewFlater_1-1633723470962.png" alt="DrewFlater_1-1633723470962.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use some code like this to have two parameter for picking the base and update layers, and a value table to pick the matching fields from the two datasets&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def getParameterInfo(self):
        """Define parameter definitions"""
        p1 = arcpy.Parameter(displayName="Input Base Features", 
                             name="base_Features", 
                             datatype="GPFeatureLayer", 
                             parameterType="Required", 
                             direction="Input")
        p2 = arcpy.Parameter(displayName="Input Updated Features", 
                             name="updated_Features", 
                             datatype="GPFeatureLayer", 
                             parameterType="Required", 
                             direction="Input")
        p3 = arcpy.Parameter(displayName="Compare Fields", 
                             name="compareFields", 
                             datatype="GPValueTable", 
                             parameterType="Optional", 
                             direction="Input")
        p3.columns = [['GPString', 'Base Fields'], ['GPString', 'Updated Fields']]

        params = [p1,p2,p3]
        return params

    def isLicensed(self):
        """Set whether tool is licensed to execute."""
        return True

    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].valueAsText and parameters[1].valueAsText:
            desc_b = arcpy.Describe(parameters[0].value)
            desc_u = arcpy.Describe(parameters[1].value)
            parameters[2].filters[0].list = [field.name for field in desc_b.fields]
            parameters[2].filters[1].list = [field.name for field in desc_u.fields]
        return&lt;/LI-CODE&gt;&lt;P&gt;results like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DrewFlater_0-1633723452299.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24885iDCF7BCA529465E23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="DrewFlater_0-1633723452299.png" alt="DrewFlater_0-1633723452299.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 20:06:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-toolbox-parameter-question/m-p/1106113#M62602</guid>
      <dc:creator>DrewFlater</dc:creator>
      <dc:date>2021-10-08T20:06:23Z</dc:date>
    </item>
  </channel>
</rss>

