AnsweredAssumed Answered

Populate field by the field of a one-to-many related table in python

Question asked by deleted-user-t3dSviijg-m9 on May 9, 2017
Latest reply on May 10, 2017 by deleted-user-t3dSviijg-m9

Trying to figure this out but am having trouble understanding what I fundamentally need to do....

I have a one-to-many relationship class. The one is fire hydrant. The many is fire hydrant inspections.

They are related by a unique FacilityID.

Both tables have a column called "CurrentPosition", and both of those columns have the same domain.

I am trying to figure out the correct procedure to make a python script that will parse through the inspections table, find the most recent inspection (by the field InspectionDate), take the value found in that record for CurrentPosition, and write it to the CurrentPosition field of the HydrantTable.

I am planning on finalizing this and having it run as a nightly task so any inspections performed, the current position is updated on the hydrant table that night.


My first thought was to make a temporary join, after making a definition query that only allows inspections performed between a set period of time. And then using the calculate field management to update the CurrentPosition, and then release the join. But my definition query on the related table was screwy and kept failing. 


Does anyone have any suggestions or documentation I can look up? Anyone doing anything similar?

Thanks very much in advance!