<?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 Handle MultiValue Parameters in Python Toolbox Tool in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/how-to-handle-multivalue-parameters-in-python/m-p/1395419#M27221</link>
    <description>&lt;P&gt;Seems alright to me. Remember a multi-value comes back as semi-colon separated, so first thing I tend to do split it into a list. You can add the following line to your execute function to get an idea of what is returned.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.AddMessage(account_numbers.split(";"))	&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 13 Mar 2024 16:50:34 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2024-03-13T16:50:34Z</dc:date>
    <item>
      <title>How to Handle MultiValue Parameters in Python Toolbox Tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-handle-multivalue-parameters-in-python/m-p/1392080#M27207</link>
      <description>&lt;P&gt;I am working on a tool for our Planning team. What this tool needs to do is take input parcel account numbers and a buffer distance before it selects the input parcels, creates a buffer, selects all parcels in the buffer, and then runs a bunch of calculations. Normally, a single parcel is used as the input, but on rare occasions multiple parcels are used as the input.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've set up a model in ArcGIS Pro and exported to python to help me get started. Here's what I've got so far:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from sys import argv

temp = r"\\\\Workspace\Location"
arcpy.env.scratchWorkspace = temp
arcpy.env.workspace = temp
arcpy.env.overwriteOutput = True
arcpy.AddMessage(arcpy.env.workspace)
arcpy.overwriteOutput = True


class Toolbox:
    def __init__(self):
        """Define the toolbox (the name of the toolbox is the name of the
        .pyt file)."""
        self.label = "Toolbox"
        self.alias = "toolbox"

        # List of tool classes associated with this toolbox
        self.tools = [Tool]


class Tool:
    def __init__(self):
        """Define the tool (tool name is the name of the class)."""
        self.label = "Zoning Maps Tool"
        self.description = ""

    def getParameterInfo(self):
        """Define the tool parameters."""
        params = [
            arcpy.Parameter(displayName="Account",
                            name="account_numbers",
                            datatype="GPString",
                            parameterType="Required",
                            direction="Input",
                            multiValue= True),
            
            arcpy.Parameter(displayName="Buffer (Feet)",
                            name="buffer",
                            datatype="Double",
                            parameterType="Required",
                            direction="Input")
                  ]          
        return params

    def isLicensed(self):
        """Set whether the tool is licensed to execute."""
        return True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Below is a picture of the input before I run the tool.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Zoning Maps Tool.png" style="width: 474px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/97119i9609DCC966E61207/image-size/large?v=v2&amp;amp;px=999" role="button" title="Zoning Maps Tool.png" alt="Zoning Maps Tool.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is this the correct way to handle multiple input parcels? How should I set up the select tool to handle multiple parcels?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    def execute(self, parameters, messages):
        """The source code of the tool."""
        account_numbers = parameters[0].valueAsText
        buffer = parameters[1].valueAsText&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 19:36:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-handle-multivalue-parameters-in-python/m-p/1392080#M27207</guid>
      <dc:creator>BradyWalker2</dc:creator>
      <dc:date>2024-03-06T19:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to Handle MultiValue Parameters in Python Toolbox Tool</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/how-to-handle-multivalue-parameters-in-python/m-p/1395419#M27221</link>
      <description>&lt;P&gt;Seems alright to me. Remember a multi-value comes back as semi-colon separated, so first thing I tend to do split it into a list. You can add the following line to your execute function to get an idea of what is returned.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcpy.AddMessage(account_numbers.split(";"))	&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 13 Mar 2024 16:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/how-to-handle-multivalue-parameters-in-python/m-p/1395419#M27221</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2024-03-13T16:50:34Z</dc:date>
    </item>
  </channel>
</rss>

