HOW TO
Instructions provided describe how to join an archive class with another table in ArcMap or programmatically through the use of the IQueryDef interface.
Code:
'Getting the timestamp from a historical marker which will be used in the where clause
Set historicalVersion = historicalWorkspace.FindHistoricalVersionByName("MarkerName")
time = historicalVersion.TimeStamp
'Getting the name of the historical archive table
Set featureClass = featureWorkspace.OpenFeatureClass("MAPGRID")
Set archivedClass = featureClass
Set archiveTable = archivedClass.Archive
Set dataset = archiveTable
archivedTableName = dataset.BrowseName
'Creating the new query def and defining the where clause which uses the date and specifies the join condition
Set QueryDef = featureWorkspace.CreateQueryDef
QueryDef.Tables = archivedTableName & ",JoinTable"
QueryDef.SubFields = ""
QueryDef.WhereClause = archivedTableName & ".GDB_FROM_DATE <= '" & time & "' AND " & archivedTableName & ".GDB_TO_DATE > '" & time & "' AND " & archivedTableName & ".ID = JoinTable.ID "
'Executing the join in the database and working with the cursor's result set
Set rowCursor = QueryDef.Evaluate
Set Row = rowCursor.NextRow
Get help from ArcGIS experts
Download the Esri Support App