<?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 Re: vb.net compare fields in two tables in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295398#M7676</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Join the two tables together and run a query to select the records where the field in the old table does not equal the field in the new table.&amp;nbsp; You should be able to do this in ArcMap without writing any code but you can do it through code if you want.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 Oct 2010 18:42:48 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2010-10-29T18:42:48Z</dc:date>
    <item>
      <title>vb.net compare fields in two tables</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295397#M7675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We have a .dbf table of employee home addresses and work locations.&amp;nbsp; Every quarter we are supposed to receive an update for this table.&amp;nbsp; What I need to do is compare changes in employee home address field and work location field between the original and the update.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on how to do this via ArcObjects?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Oct 2010 18:15:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295397#M7675</guid>
      <dc:creator>KevinThomas1</dc:creator>
      <dc:date>2010-10-29T18:15:07Z</dc:date>
    </item>
    <item>
      <title>Re: vb.net compare fields in two tables</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295398#M7676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Join the two tables together and run a query to select the records where the field in the old table does not equal the field in the new table.&amp;nbsp; You should be able to do this in ArcMap without writing any code but you can do it through code if you want.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 Oct 2010 18:42:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295398#M7676</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2010-10-29T18:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: vb.net compare fields in two tables</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295399#M7677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello all,&lt;BR /&gt;We have a .dbf table of employee home addresses and work locations.&amp;nbsp; Every quarter we are supposed to receive an update for this table.&amp;nbsp; What I need to do is compare changes in employee home address field and work location field between the original and the update.&lt;BR /&gt;&lt;BR /&gt;Any suggestions on how to do this via ArcObjects?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thanks&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In ArcObjects you can operate on a layer with a join and access the joined fields or query the joined records through the IDisplayTable interface.&amp;nbsp; Some sample code (in VBA) that assumes the joined layer is the first layer in the map and already has a join in place is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;Public Sub GetDifferencesInJoinedRecords()
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMxDoc As IMxDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMxDoc = ThisDocument
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pFLayer As IFeatureLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pFLayer = pMxDoc.FocusMap.Layer(0) 'Get first layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pDisplayTable As IDisplayTable
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pDisplayTable = pFLayer
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; If Not TypeOf pDisplayTable.DisplayTable Is IRelQueryTable Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "Feature Layer is not joined!&amp;nbsp; Exiting Sub."
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pQF as IQueryFilter
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pQF = New QueryFilter

&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Add some type of SQL selection to compare your joined table.&amp;nbsp; Test it first in the Select by Attributes dialog
&amp;nbsp;&amp;nbsp;&amp;nbsp; pQF.Whereclause = "ParentTableName.MyField &amp;lt;&amp;gt; JoinTableName.MyField"

&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pTableCursor As ICursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pTableCursor = pDisplayTable.SearchDisplayTable pQF, False
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRow As IRow
&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRow = pTableCursor.NextRow
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pParentIndex As Long
&amp;nbsp;&amp;nbsp;&amp;nbsp; pParentIndex = pDisplayTable.DisplayTable.Fields.FindField("ParentTableName.myField") ' Substitute the actual Parent Table Name and Field Name
&amp;nbsp;&amp;nbsp;&amp;nbsp; If pParentIndex = -1 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "ParentTableName.myField Field Not Found! Exiting Sub." ' Substitute the appropriate message.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pJoinIndex As Long
&amp;nbsp;&amp;nbsp;&amp;nbsp; pJoinIndex = pDisplayTable.DisplayTable.Fields.FindField("JoinTableName.myField") ' Substitute the real Join Table Name and Field Name
&amp;nbsp;&amp;nbsp;&amp;nbsp; If pJoinIndex = -1 Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox "JoinTableName.myField Field Not Found! Exiting Sub." ' Fix the Message for your data
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit Sub
&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until pRow Is Nothing ' Keep your loop as tight as possible and do not do Dim statements inside of it.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Do something in the loop
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print pRow.Value(pParentIndex) &amp;amp; " &amp;lt;&amp;gt; " &amp;amp; pRow.Value(pJoinIndex) ' report value of field in join table
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRow = pTableCursor.NextRow
&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop
Exit Sub&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:11:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/vb-net-compare-fields-in-two-tables/m-p/295399#M7677</guid>
      <dc:creator>RichardFairhurst</dc:creator>
      <dc:date>2021-12-11T14:11:18Z</dc:date>
    </item>
  </channel>
</rss>

