The following script creates a stack of temporary feature layers each for all entries that share the same PropertyID (it's a simple range-loop since the values seem to be just integers). Then it copies from each temporary feature layer the one with the highest PERCENTAGE value into a new feature class or whatever is needed:
import arcpy
#this is your Parcel_Test_SpatialJoin_Tabu1:
parcel = arcpy.GetParameterAsText(0)
#returns the maximum value in the field "PERCENTAGE":
def max_percent(input):
cursor = arcpy.SearchCursor(input)
percentlist = []
for row in cursor:
percentages = row.getValue("PERCENTAGE")
percentlist.append(percentages)
return max(percentlist)
#returns a temporary feature lyer resulting of expr:
def sel_n(inputFC, expr, PropertyID):
temp_lyr = "temp_lyr_%s" %(PropertyID)
arcpy.MakeFeatureLayer_management(inputFC,temp_lyr, expr)
return temp_lyr
#list to filled with the desired entries:
max_per_id = []
target = either_a_new_FC_or_a_table
#since the values of "PropertyID" seem to be all integers:
for i in range(insert_the_highest_value_of_PropertyID_here):
expr = "PropertyID = %s" %(i)
max_per_id.append(max_percent(sel_n(parcel,expr,i)))
arcpy.Append_management (inputs, target, "TEST")
I didn't test this script, I just fiddled it together from what I have since i am currently working on a similar issue.
If you really need ALL values of a selection "PropertyID = X" preserved I suggest to either expand the script with arcpy.Dissolve_Management in the max_percent function or insert the other values you want to keep in separate fields programmatically. Since I do not know your requirements for your result i cant help you further.
I am sure there might be a less copious approach to this - perhaps even in ModelBuilder.
The JOIN id is what i need to preserve for each propertyID
– somebodyonce Nov 09 '16 at 20:34