Original User: blingenfelderI am somewhat new to creating models and have run into a problem with the one that I am currently working on. My goal is to Iterate rows of one shapefile, "sections", and perform a select by location to find the "tracts" that have their centroid in each section. Then, I would like to summarize a field for these selected tracts within each section. I have successfully done this and output the values to a table, although the table will only keep one record at a time, overwriting the table each time instead of adding a new row. Even so, I am trying to figure out a way to add this calculated value to a field of the current record in the iteration of my "sections" shapefile.I have explored the option of trying to do a table join, but I don't think that this will work because of the many to one (tracts to section) relationship and that there is no unique key between the two. I will attach my script and graphic. Any advice would help, thanks in advance![ATTACH=CONFIG]26997[/ATTACH]
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Test.py
# Created on: 2013-08-26 15:08:04.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import arcpy
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")
# Local variables:
LPMGIS_LEASE_ACTIVE_TRACT = "Core Layers\\LPMGIS.LEASE.ACTIVE_TRACT"
Sections_Result = "Sections_Result"
Sections = "Sections"
I_Sections = "I_Sections_FID"
LPMGIS_LEASE_ACTIVE_TRACT__3_ = "Core Layers\\LPMGIS.LEASE.ACTIVE_TRACT"
grs_acre_sum = "U:\\SectionAcreageTest\\grs_acre_sum"
# Process: Iterate Row Selection
arcpy.IterateRowSelection_mb(Sections, "", "false")
# Process: Select Layer By Location
arcpy.SelectLayerByLocation_management(LPMGIS_LEASE_ACTIVE_TRACT, "HAVE_THEIR_CENTER_IN", I_Sections, "", "NEW_SELECTION")
# Process: Summary Statistics
arcpy.Statistics_analysis(LPMGIS_LEASE_ACTIVE_TRACT__3_, grs_acre_sum, "T_GRS_AREA SUM", "")
# Process: Get Field Value
arcpy.GetFieldValue_mb(grs_acre_sum, "SUM_T_GRS_AREA", "Double", "0")