I have a script that I am trying to add/ include multiple parameters for multiple features. Parcels 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.
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)) > 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)) > 0:
arcpy.CalculateField_management(SP, "PermitNo", '"' +Casenum+'"', "PYTHON_9.3") #"!{0}!".format(values)
