AnsweredAssumed Answered

Get Differences from Default and Historic Table

Question asked by HimBromBeere on Sep 25, 2014



I have an archieved table AA00001_FDV from which I need all rows that have been changed or newly created during a given amount of time (let´s say during the last year). Following the steps provided here I created a DifferenceCursor. Hence I do not need ALL updated rows I added a QueryFilter to return only features that have attribute OTYP = "AX11001" and that changed during the timespan.


// Cast to the IHistoricalWorkspace interface and get the version from before the Stichtag and default versions.
IHistoricalWorkspace historicalWorkspace = (IHistoricalWorkspace)this.workspaceExtension.Workspace;
IHistoricalVersion defaultVersion = historicalWorkspace.FindHistoricalVersionByName(historicalWorkspace.DefaultMarkerName);
IHistoricalVersion historicalVersion = historicalWorkspace.FindHistoricalVersionByTimeStamp((DateTime) this.StichTagDerAuswertung);

// Cast both versions to IFeatureWorkspace and open the table from each.
IFeatureWorkspace defaultFWS = (IFeatureWorkspace)defaultVersion;
IFeatureWorkspace historicalFWS = (IFeatureWorkspace)historicalVersion;
ITable defaultTable = defaultFWS.OpenTable("AA00001_FDV");
ITable historicalTable = historicalFWS.OpenTable("AA00001_FDV");

// Create a difference cursor.
IDifferenceCursor differenceCursor = ((IVersionedTable)defaultTable).Differences(historicalTable, esriDifferenceType.esriDifferenceTypeUpdateNoChange, new QueryFilter { WhereClause = "OTYP = 'AX11001'"});

// Create output variables for the IDifferenceCursor.Next method and a FID set.
IFIDSet fidSet = new FIDSetClass();
IRow differenceRow = null;
int objectID = -1;
List<string> uuids = new List<string>();

// Step through the cursor, showing the ID of each modified row.
differenceCursor.Next(out objectID, out differenceRow);
while (objectID != -1)
    uuids.Add(differenceRow.get_Value(1) as string);
    differenceCursor.Next(out objectID, out differenceRow);



But I do not get any results from the cursor although my archieve-table ( AA00001_FDV_H) has many rows with GDB_FROM- and TO_DATE set. I suppose its because of the  esriDifferenceType which I do not completely understand.I further suppose that the cursor should only return rows that are changed within historic table AND default one because changing data within default-version impilictly changes according data within archieve-table. Is this assumption true or am I missing sth. obvious?


Thanks for your help