<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get Differences from Default and Historic Table in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-differences-from-default-and-historic-table/m-p/133109#M3456</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an archieved table &lt;SPAN style="color: #303030;"&gt;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 &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/d/00010000021t000000.htm"&gt;here&lt;/A&gt;&lt;/SPAN&gt; I created a DifferenceCursor. Hence I do not need ALL updated rows I added a QueryFilter to return only features that have attribute &lt;STRONG&gt;OTYP = "AX11001"&lt;/STRONG&gt; and that changed during the timespan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14116551619629907 jive_text_macro" jivemacro_uid="_14116551619629907"&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Cast to the IHistoricalWorkspace interface and get the version from before the Stichtag and default versions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalWorkspace&lt;/SPAN&gt; historicalWorkspace = (&lt;SPAN style="color: #2b91af;"&gt;IHistoricalWorkspace&lt;/SPAN&gt;)&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.workspaceExtension.Workspace;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalVersion&lt;/SPAN&gt; defaultVersion = historicalWorkspace.FindHistoricalVersionByName(historicalWorkspace.DefaultMarkerName);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalVersion&lt;/SPAN&gt; historicalVersion = historicalWorkspace.FindHistoricalVersionByTimeStamp((&lt;SPAN style="color: #2b91af;"&gt;DateTime&lt;/SPAN&gt;) &lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.StichTagDerAuswertung);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Cast both versions to IFeatureWorkspace and open the table from each.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt; defaultFWS = (&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt;)defaultVersion;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt; historicalFWS = (&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt;)historicalVersion;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;ITable&lt;/SPAN&gt; defaultTable = defaultFWS.OpenTable(&lt;SPAN style="color: #a31515;"&gt;"AA00001_FDV"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;ITable&lt;/SPAN&gt; historicalTable = historicalFWS.OpenTable(&lt;SPAN style="color: #a31515;"&gt;"AA00001_FDV"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Create a difference cursor.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IDifferenceCursor&lt;/SPAN&gt; differenceCursor = ((&lt;SPAN style="color: #2b91af;"&gt;IVersionedTable&lt;/SPAN&gt;)defaultTable).Differences(historicalTable, &lt;SPAN style="color: #2b91af;"&gt;esriDifferenceType&lt;/SPAN&gt;.esriDifferenceTypeUpdateNoChange, &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;QueryFilter&lt;/SPAN&gt; { WhereClause = &lt;SPAN style="color: #a31515;"&gt;"OTYP = 'AX11001'"&lt;/SPAN&gt;});&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Create output variables for the IDifferenceCursor.Next method and a FID set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFIDSet&lt;/SPAN&gt; fidSet = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;FIDSetClass&lt;/SPAN&gt;();&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IRow&lt;/SPAN&gt; differenceRow = &lt;SPAN style="color: blue;"&gt;null&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; objectID = -1;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;gt; uuids = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Step through the cursor, showing the ID of each modified row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;differenceCursor.Next(&lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; objectID, &lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; differenceRow);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: blue;"&gt;while&lt;/SPAN&gt; (objectID != -1)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uuids.Add(differenceRow.get_Value(1) &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fidSet.Add(objectID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; differenceCursor.Next(&lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; objectID, &lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; differenceRow);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;fidSet.Reset();&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I do not get any results from the cursor although my archieve-table ( &lt;SPAN style="color: #303030;"&gt;AA00001_FDV_H) has many rows with GDB_FROM- and TO_DATE set&lt;/SPAN&gt;. I suppose its because of the&amp;nbsp; &lt;SPAN style="color: #2b91af;"&gt;esriDifferenceType&lt;/SPAN&gt; 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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Sep 2014 14:23:37 GMT</pubDate>
    <dc:creator>CarstenSchumann</dc:creator>
    <dc:date>2014-09-25T14:23:37Z</dc:date>
    <item>
      <title>Get Differences from Default and Historic Table</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/get-differences-from-default-and-historic-table/m-p/133109#M3456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an archieved table &lt;SPAN style="color: #303030;"&gt;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 &lt;A href="http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#/d/00010000021t000000.htm"&gt;here&lt;/A&gt;&lt;/SPAN&gt; I created a DifferenceCursor. Hence I do not need ALL updated rows I added a QueryFilter to return only features that have attribute &lt;STRONG&gt;OTYP = "AX11001"&lt;/STRONG&gt; and that changed during the timespan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c#" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14116551619629907 jive_text_macro" jivemacro_uid="_14116551619629907"&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Cast to the IHistoricalWorkspace interface and get the version from before the Stichtag and default versions.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalWorkspace&lt;/SPAN&gt; historicalWorkspace = (&lt;SPAN style="color: #2b91af;"&gt;IHistoricalWorkspace&lt;/SPAN&gt;)&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.workspaceExtension.Workspace;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalVersion&lt;/SPAN&gt; defaultVersion = historicalWorkspace.FindHistoricalVersionByName(historicalWorkspace.DefaultMarkerName);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IHistoricalVersion&lt;/SPAN&gt; historicalVersion = historicalWorkspace.FindHistoricalVersionByTimeStamp((&lt;SPAN style="color: #2b91af;"&gt;DateTime&lt;/SPAN&gt;) &lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.StichTagDerAuswertung);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Cast both versions to IFeatureWorkspace and open the table from each.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt; defaultFWS = (&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt;)defaultVersion;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt; historicalFWS = (&lt;SPAN style="color: #2b91af;"&gt;IFeatureWorkspace&lt;/SPAN&gt;)historicalVersion;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;ITable&lt;/SPAN&gt; defaultTable = defaultFWS.OpenTable(&lt;SPAN style="color: #a31515;"&gt;"AA00001_FDV"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;ITable&lt;/SPAN&gt; historicalTable = historicalFWS.OpenTable(&lt;SPAN style="color: #a31515;"&gt;"AA00001_FDV"&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Create a difference cursor.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IDifferenceCursor&lt;/SPAN&gt; differenceCursor = ((&lt;SPAN style="color: #2b91af;"&gt;IVersionedTable&lt;/SPAN&gt;)defaultTable).Differences(historicalTable, &lt;SPAN style="color: #2b91af;"&gt;esriDifferenceType&lt;/SPAN&gt;.esriDifferenceTypeUpdateNoChange, &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;QueryFilter&lt;/SPAN&gt; { WhereClause = &lt;SPAN style="color: #a31515;"&gt;"OTYP = 'AX11001'"&lt;/SPAN&gt;});&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Create output variables for the IDifferenceCursor.Next method and a FID set.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IFIDSet&lt;/SPAN&gt; fidSet = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;FIDSetClass&lt;/SPAN&gt;();&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;IRow&lt;/SPAN&gt; differenceRow = &lt;SPAN style="color: blue;"&gt;null&lt;/SPAN&gt;;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: blue;"&gt;int&lt;/SPAN&gt; objectID = -1;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #2b91af;"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;gt; uuids = &lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt; &lt;SPAN style="color: #2b91af;"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;gt;();&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: green;"&gt;// Step through the cursor, showing the ID of each modified row.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;differenceCursor.Next(&lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; objectID, &lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; differenceRow);&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: blue;"&gt;while&lt;/SPAN&gt; (objectID != -1)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; uuids.Add(differenceRow.get_Value(1) &lt;SPAN style="color: blue;"&gt;as&lt;/SPAN&gt; &lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fidSet.Add(objectID);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; differenceCursor.Next(&lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; objectID, &lt;SPAN style="color: blue;"&gt;out&lt;/SPAN&gt; differenceRow);&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;fidSet.Reset();&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I do not get any results from the cursor although my archieve-table ( &lt;SPAN style="color: #303030;"&gt;AA00001_FDV_H) has many rows with GDB_FROM- and TO_DATE set&lt;/SPAN&gt;. I suppose its because of the&amp;nbsp; &lt;SPAN style="color: #2b91af;"&gt;esriDifferenceType&lt;/SPAN&gt; 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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Sep 2014 14:23:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/get-differences-from-default-and-historic-table/m-p/133109#M3456</guid>
      <dc:creator>CarstenSchumann</dc:creator>
      <dc:date>2014-09-25T14:23:37Z</dc:date>
    </item>
  </channel>
</rss>

