The archive class is created and maintained by the geodatabase when a dataset or class is enabled for archiving. Archive classes are not accessible in data browsers, but they can be added to ArcMap for viewing and querying.
To add an archive class to ArcMap, you must first highlight an archive-enabled layer or table in the table of contents. Then the Add Historical Archive button is enabled on the Geodatabase History toolbar.
Click the button to add the archive class to the map. The archive class displays every modification since archiving was enabled. The archive class cannot be edited and is for analysis purposes only.
Adding the archive class to the map allows you to work directly with the archive. You can symbolize the layer to help with your analysis. For example, using the GDB_FROM_DATE field as the value field for your symbology color codes the features in the layer based on the time they were last updated.
There are two types of queries that will satisfy most questions addressing a class's history: moment and range queries.
Moment queries are used to query a specific moment in time, which is the same as working with an historical version and connecting to the date and time of interest. These queries are helpful when trying to determine how the data looked at a specific moment or what was in a particular location at a given moment.
Range queries work with the data over a span of time between two moments, a starting moment and an ending moment. These queries allow you to view how a feature or location has changed through time. By looking at time ranges, you can track how an object has been updated throughout its lifetime. This shows you how the data has evolved and allows you to see and compare changes in an object.
Both moment or range queries can be constructed in the ArcMap definition query builder.
If you are interested in seeing a specific feature at a specific time, refer to its object ID and enter the appropriate date and time.
The following is an example of this type of moment query:
OBJECTID = 23 AND GDB_FROM_DATE <= '2005-10-12 14:11:20' and GDB_TO_DATE > '2005-10-12 14:11:20'
It is important to note that the syntax of the GDB_FROM_DATE and GDB_TO_DATE fields might differ depending on how the database is storing dates. You can easily check the format by selecting GDB_FROM_DATE or GDB_TO_DATE and clicking Get Unique Values in the query builder.
To perform a range query using the query builder, open the Query Builder dialog box by right-clicking the archive class and choosing Properties. Click the Definition Query tab and click the Query Builder button.
The archive class has two fields that help query for date and time ranges: GDB_FROM_DATE and GDB_TO_DATE. Choose one of these fields and click the Get Unique Values button to see the values and syntax of the date field. You can then build queries using these values or input your own dates of interest.
For example, if you want to see how a geographic area changed between May 1, 2003, and June 1, 2005, you could construct the following query:
GDB_FROM_DATE > '2003-05-01 12:00:00' AND GDB_FROM_DATE < '2005-06-01 12:00:00'
This returns all rows inserted and updated between these dates.
It is possible to detect all insertions, updates, or deletions between two moments. Developers interested in detecting these types of changes should refer to the IVersionedTable interface within the software developer kit.
Renaming the archive class
To change the name of an archive class:
- Right-click the feature class or table in the Catalog tree.
- Click Properties.
- Click the General tab.
- At the bottom of the dialog box is a section with the date and time archiving was enabled, and the archive class name. Click in the text box next to Archive Class Name and enter a new name.
Managing indexes on an archive class
You can manage indexes on an archive class in the same manner as any other feature class or table.
- Right-click the feature class or table in the Catalog tree.
- Click Properties.
- Click the Indexes tab.
- At the top of the dialog box, select Archive Class from the Attribute Indexes drop-down list.
- Now you can modify the attribute and spatial indexes of the archive class. For more information, see Creating attribute indexes and Modifying a spatial index.