Parsing data from flat geodatabase, trouble with related table records

Discussion created by roy_hewitt on Apr 16, 2012
I'm working on a python script that parses data from a flat gdb structure (one feature class and one related table) that is used in the field with arcpad.  When the data is brought back to the office I'd like it in a more appropriate structure (individual feature classes for each point type with requisite tables). 

I've had a fair amount of luck parsing the data through the use of cursors, but the data doesn't seem to be following the relationship classes I've set up.  The strangest part is that several records at the end of the table work as expected (select a point within a feature class, then use the 'related tables' button within the attribute table to show all related records).  The code checks that the field that the relationship class is based on is the same before creating a related record, so there is no way that they could differ.

I can't imagine how the relationship classes would work some times and not others considering this was done programatically and the same code was looped through to produce both results.

To give you an idea of the code (only an excerpt):
# Create search cursor to loop through rows of field points
fpCursor  = arcpy.UpdateCursor(fieldPoints)

# Get name of the field that stores geometry data (location of point)
shapeName = arcpy.Describe(fieldPoints).shapeFieldName

# Counter for points
j = 1
for fp in fpCursor:
    i = 1 # Counter for Related record loop
    oid    = fp.getValue("OBJECTID")
    ptGeom = fp.getValue(shapeName) # Geometry field (shape)
    if fp.getValue("PointName") == "": # If the Point Name field is empty, copy the OID from the record
        fp.PointName = str(oid)
        ptName = fp.getValue("PointName")
        ptType = fp.getValue("PointType")
        ptDate = fp.getValue("PointDate")
        active = fp.getValue("Active")
        ptComm = fp.getValue("Comments")
        print "Point number: " + str(j) + "."
    # Loop through each row in related field data table
    fdCursor  = arcpy.SearchCursor(fieldData)
    for fd in fdCursor:
        fdDate = fd.getValue("PointDate")

        # If the record in the field data fc has the same date/time stamp as the related table, copy fields
        if fdDate == ptDate:
            fdCheck  = fd.getValue("CheckDate")
            surType  = fd.getValue("SurveyType")
            fdType   = fd.getValue("PointType")
            special  = fd.getValue("Specialist")
            lure1    = fd.getValue("LureType1")
            lure2    = fd.getValue("LureType2")
            fdComm   = fd.getValue("Comments")
            photo    = fd.getValue("PhotoLink")
            signType = fd.getValue("SignType")
            signAmt  = fd.getValue("SignAmount")
            platSet  = fd.getValue("PlatformSet")
            platSign = fd.getValue("PlatformSign")
            trapType = fd.getValue("TrapType")
            trapAct  = fd.getValue("TrapAction")
            trapStat = fd.getValue("TrapStatus")
            capSpec  = fd.getValue("CaptureSpecies")
            capSex   = fd.getValue("CaptureSex")
            capType  = fd.getValue("CaptureType")
            trapSet  = fd.getValue("TrapSetClass")
            print "This is related record number: " + str(i) + "."
            # If this is the first record in the related table, it is information pertaining to the 'Original Point Type'    
            if i == 1:
                if ptType == "Platform":
                    # Create record in feature class
                    platformCursor = arcpy.InsertCursor(platforms)
                    platformRow = platformCursor.newRow()
                    # 'Paste' data into each field from variable
                    platformRow.Shape     = ptGeom
                    platformRow.PointDate = ptDate
                    platformRow.PointName = ptName
                    platformRow.Active    = active
                    platformRow.Comments  = ptComm
                    platformCursor.insertRow(platformRow) # Insert new record into feature class
                    del platformCursor, platformRow

                    # Create insert cursor to add new record into related table
                    platTbCursor = arcpy.InsertCursor(platData)
                    platTbRow = platTbCursor.newRow()
                    # 'Paste' data into each field from variable
                    platTbRow.LureType1    = lure1
                    platTbRow.LureType2    = lure2
                    platTbRow.Comments     = fdComm 
                    platTbRow.PointDate    = ptDate
                    platTbRow.CheckDate    = fdCheck
                    platTbRow.SurveyType   = surType
                    platTbRow.Specialist   = special
                    platTbRow.PhotoLink    = photo
                    platTbRow.PlatformSet  = platSet
                    platTbRow.PlatformSign = platSign
                    platTbCursor.insertRow(platTbRow) #Insert new record into related table
                    del platTbCursor, platTbRow # Cleanup insert cursor

      --- Continues for more point types, increments both counters

Could this have anything to do with data locks?  I tried to be careful about cleaning up cursors...