<?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: Multivalue parameter and multi features in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1106747#M62619</link>
    <description>&lt;P&gt;I have this but how do I split the GetParameter into two if two parameters(GetParameterAsText(2))&amp;nbsp; are given and apply one to each Pin?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = arcpy.mapping.ListLayers(mxd, "TAXLOTS")[0]

#Parcel numbers
values = arcpy.GetParameterAsText(0)
fieldName = "PIN"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

#selects the parcel numbers and creates Subject property
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

#AddsPermitNumber
Casenum = arcpy.GetParameterAsText(2)
SP = "SUBJECT"

arcpy.SelectLayerByLocation_management(SP, "INTERSECT", SP, "", "NEW_SELECTION")
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
    arcpy.CalculateField_management(SP, "PermitNo", '"' +Casenum+'"', "PYTHON_9.3") #"!{0}!".format(values)

args = [arcpy.GetParameterAsText(1)for i in range(arcpy.GetArgumentCount())]
#pCount = arcpy.GetArgumentCount(1)

if args == 2: #
    dsc = arcpy.Describe(SP)
    fields = dsc.fields
    #out_fields = [dsc.OIDFieldName]
    fieldnames = [field.name for field in fields]

    #lstFields = [field.name for field in fields]

    with arcpy.da.SearchCursor(SP,fieldnames) as sCur:
       with arcpy.da.InsertCursor(SP,fieldnames) as iCur:
          for row in sCur:
              iCur.insertRow(row)
else:
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I get the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Pin&lt;/TD&gt;&lt;TD&gt;Permit No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12345&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12346&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But need&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Pin&lt;/TD&gt;&lt;TD width="50%"&gt;Permit No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12345&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12346&lt;/TD&gt;&lt;TD width="50%"&gt;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Tue, 12 Oct 2021 16:22:32 GMT</pubDate>
    <dc:creator>CCWeedcontrol</dc:creator>
    <dc:date>2021-10-12T16:22:32Z</dc:date>
    <item>
      <title>Multivalue parameter and multi features</title>
      <link>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1105021#M62582</link>
      <description>&lt;P&gt;I have a script that I am trying to add/ include multiple parameters for multiple features. Parcels&amp;nbsp; can have multiple case numbers associated with them. For example Parcel Pin12345 can have permit MC2021-0001 and CD20201-0001. I want to be able to create two separate parcels\features with the same Pin12345 but different permit numbers but only if I input multiple Parameters. If I just enter one parameter in then I just need one pin with the case I enter. Sometimes case number can have 2 or 10 parcels for that particular case. I am not sure what is the best way to do this but this is what I have and it works great with just one case no.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = arcpy.mapping.ListLayers(mxd, "TAXLOTS")[0]

#Parcel numbers
values = arcpy.GetParameterAsText(0)
fieldName = "PIN"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

#selects the parcel numbers and creates Subject property
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

#AddsPermitNumber
Casenum = arcpy.GetParameterAsText(2)
SP = "SUBJECT"

arcpy.SelectLayerByLocation_management(SP, "INTERSECT", SP, "", "NEW_SELECTION")
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
    arcpy.CalculateField_management(SP, "PermitNo", '"' +Casenum+'"', "PYTHON_9.3") #"!{0}!".format(values)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Example.png" style="width: 717px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/24607i754C600A6B97E94D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Example.png" alt="Example.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Oct 2021 14:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1105021#M62582</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-10-06T14:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue parameter and multi features</title>
      <link>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1106747#M62619</link>
      <description>&lt;P&gt;I have this but how do I split the GetParameter into two if two parameters(GetParameterAsText(2))&amp;nbsp; are given and apply one to each Pin?&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyr = arcpy.mapping.ListLayers(mxd, "TAXLOTS")[0]

#Parcel numbers
values = arcpy.GetParameterAsText(0)
fieldName = "PIN"
values = values.split(";")  # split values into list
values = ["'{0}'".format(v) for v in values] # add single quotes
whereClause = "{0} IN ({1})".format(fieldName, ",".join(values))
arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)

#selects the parcel numbers and creates Subject property
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.Select_analysis("TAXLOTS", "SUBJECT")
arcpy.SelectLayerByAttribute_management("TAXLOTS", "CLEAR_SELECTION")

#AddsPermitNumber
Casenum = arcpy.GetParameterAsText(2)
SP = "SUBJECT"

arcpy.SelectLayerByLocation_management(SP, "INTERSECT", SP, "", "NEW_SELECTION")
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
    arcpy.CalculateField_management(SP, "PermitNo", '"' +Casenum+'"', "PYTHON_9.3") #"!{0}!".format(values)

args = [arcpy.GetParameterAsText(1)for i in range(arcpy.GetArgumentCount())]
#pCount = arcpy.GetArgumentCount(1)

if args == 2: #
    dsc = arcpy.Describe(SP)
    fields = dsc.fields
    #out_fields = [dsc.OIDFieldName]
    fieldnames = [field.name for field in fields]

    #lstFields = [field.name for field in fields]

    with arcpy.da.SearchCursor(SP,fieldnames) as sCur:
       with arcpy.da.InsertCursor(SP,fieldnames) as iCur:
          for row in sCur:
              iCur.insertRow(row)
else:
    pass&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; I get the following&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Pin&lt;/TD&gt;&lt;TD&gt;Permit No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12345&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12346&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But need&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Pin&lt;/TD&gt;&lt;TD width="50%"&gt;Permit No&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12345&lt;/TD&gt;&lt;TD width="50%"&gt;MC2021-0002&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;12346&lt;/TD&gt;&lt;TD width="50%"&gt;CD2021-0005&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 12 Oct 2021 16:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1106747#M62619</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-10-12T16:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue parameter and multi features</title>
      <link>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1114213#M62906</link>
      <description>&lt;P&gt;I currently coping and pasting features and I haven't been able to find any examples or ideas o how I can accomplish this so any help would be very appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2021 18:20:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1114213#M62906</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-11-04T18:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Multivalue parameter and multi features</title>
      <link>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1115441#M62939</link>
      <description>&lt;P&gt;Hopefully this helps someone, not sure if this is the best way but was the only thing I can find.&lt;/P&gt;&lt;P&gt;Code below line 8 is by &lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;JoshuaBixby. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Casenum = arcpy.GetParameterAsText(1)
Splt = str(Casenum.split(";"))
arcpy.AddMessage("Case ={0}".format(Splt))
SP = "SUBJECT"
arcpy.SelectLayerByLocation_management(SP, "INTERSECT", SP, "", "NEW_SELECTION")
if int(arcpy.GetCount_management("TAXLOTS").getOutput(0)) &amp;gt; 0:
   arcpy.CalculateField_management(SP, "PermitNo", '"' + Casenum +'"', "PYTHON_9.3")
   
split_fld = "PermitNo" # Field to split
split_delim = ";"# Delimeter for splitting field

sys_flds = [
   'OIDFieldName', 'globalIDFieldName',
   'ShapeFieldName', 'areaFieldName', 'lengthFieldName' 
]

desc = arcpy.Describe(SP)
sys_fld_names = [
   name for name in (getattr(desc, fld, '') for fld in sys_flds) if name
]    
usr_fld_names = [
   fld.name for fld in desc.fields if fld.name not in [split_fld] + sys_fld_names
]
cur_flds = ["SHAPE@", split_fld] + usr_fld_names

with arcpy.da.Editor(desc.path) as edit:
   with arcpy.da.UpdateCursor(SP, cur_flds) as ucur:
       with arcpy.da.InsertCursor(SP, cur_flds) as icur:
           for row in ucur:
               shape = row.pop(0)
               split = row.pop(0).split(split_delim)
               for i in split[1:]:
                   icur.insertRow([shape, i] + row)
               ucur.updateRow([shape, split[0]] + row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 21:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/multivalue-parameter-and-multi-features/m-p/1115441#M62939</guid>
      <dc:creator>CCWeedcontrol</dc:creator>
      <dc:date>2021-11-09T21:57:01Z</dc:date>
    </item>
  </channel>
</rss>

