Setting historical version of layer

174
1
10-24-2017 09:48 AM
MarkCederholm
Regular Contributor II

I'm trying to set the historical version of a layer using ChangeVersion_management, but it's not working in Desktop (10.2.1, 10.5.1).  When I export the layer to a new feature class, I'm getting the current features rather than the historical ones.  What am I doing wrong?

dtHistorical = datetime.date(2016, 12, 29)
iYear = dtHistorical.year
sLeakSurveyName = "LeakSurvey" + str(iYear)
arcpy.MakeFeatureLayer_management(sConnectionFile + "/LeakSurvey", "LyrLeakSurvey")
sDate = dtHistorical.strftime("%m/%d/%Y")
arcpy.ChangeVersion_management("LyrLeakSurvey", "HISTORICAL", "", sDate)
arcpy.CopyFeatures_management("LyrLeakSurvey", sLeakSurveyName)

However, the code DOES work in Pro 2.0.1!

Perhaps it's a date formatting issue?

0 Kudos
1 Reply
KevinSadrak
New Contributor III

Looks like it is a bug.

NIM087927: ChangeVersion_management() in the Python window igno.. 

And since it is has been since 2013, it will probably remain a bug.

It looks to my like arcpy doesn't like any historical versions.