Working directly with the archive class
Working directly with the archive class
|
Release 9.3 |
|
Note: This topic was updated for 9.3.1.
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 will become enabled on the Geodatabase History toolbar.
Click the button to add the archive class to the map. The archive class will display 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 will color-code 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 a 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 life span. This will show you how the data has evolved and allow you to see and compare changes in an object.
Either 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.
An example of this type of moment query is as follows:
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 may 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. Choose the Definition Query tab and then 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 will return all rows inserted and updated between these dates.
It is possible to detect all inserts, updates, or deletes between two moments. For developers interested in detecting these types of changes, please refer to the IVersionedTable interface within the software developer kit.
NOTE: Directly modifying the archive class can lead to inconsistencies within the archived data. Using ArcGIS, access to the archive class is read-only.