AnsweredAssumed Answered

Enabling Editor TRacking on New and Old FC

Question asked by jrlalessi on Jun 3, 2015
Latest reply on Jun 8, 2015 by Hornbydd

I have multiple GDBs with tons of FDS and I need to determine if they have editor tracking enabled (got that part), and if they dont I need to Know the following :

 

Case 1: Does the FC have the old default fields: ET_CREATOR.... ect

Case 2: Does the FC have the new default fields: created_user... ect

Case 3: Does the FC have both sets of default fields.

Case 4: The FC doesnt have any of the Editior Tracking default fields.

 

For case 1 and 2 I would like to enable editor tracking on the exsisting fields.

For case 3 I would like to copy the data from the old default fields to the new default fields and remove the old fields, then enable tracking on the new fields.

For case 4 I would like to enable tracking and except the default fields.

 

Im thinking that tackling the Case 3 data transfer and field removal should be done first.

 

I have very little python expierience and would a ppreciate tons of comments.

 

Heres where Im at now, I will attach a copy aswell:

 

import arcpy

import os

import string

 

#Set the workspace environment

arcpy.env.workspace = r"Z:\TempTablesTBD\Test.gdb"

 

#Define datasets, get dataset list

datasets = arcpy.ListDatasets(feature_type='feature')

datasets = [''] + datasets if datasets is not None else []

 

# Define descrete arrays to pass the data to (final resting place) arrays are by default unicode

enabledList = []

notEnabledList = []

 

#List FC in a GDB including those in an FDS but iterating through the datasets

#for a full path name replace (ds, fc) with (arcpy.env.workspace,ds,fc)

for ds in datasets:

    for fc in arcpy.ListFeatureClasses(feature_dataset=ds):

        fcList = os.path.join(ds, fc)

 

#Report if Editor Tracking is Enabled or NOT Enabled

#Create the describe object

        desc = arcpy.Describe(fc)

 

#Create temporary lists in the loop to pass the info THROUGH, type is defined as string with str

        t_enabledList = str('\t' + '-' + ds + '\n' + '\t\t' + fc)

        t_notEnabledList = str('\t' + '-' + ds + '\n' + '\t\t' + fc)

 

#Loop to determine Editor Tracking status

        if desc.editorTrackingEnabled:

            #Final resting place for enabled item names (FDS/FC)

            enabledList.append(t_enabledList)

 

        else:

            #Final resting place for non-enabled item names (FDS/FC)

            notEnabledList.append(t_notEnabledList)

 

#Loop through all values returned and print each separately, with out the loop they will print as a single

#illiterate string.

print ('Enabled:  ')

for enable in enabledList:

    print (enable)

 

print ('NOT Enabled on:  ')

for notEnabled in notEnabledList:

    print (notEnabled)

 

#Script is complete

print ('\n\n\n'+'Complete :)')

Outcomes