Creates a new Table by joining two tables together using a column which is common to both. It contains
all columns from the tables and the records specified by the join type..
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public Table Join( Table tableToJoin, string originKeyColumnName, string originForeignKeyColumnName, TableJoinType joinType ) |
Visual Basic (Declaration) |
---|
Public Function Join ( _ tableToJoin As Table, _ originKeyColumnName As String, _ originForeignKeyColumnName As String, _ joinType As TableJoinType _ ) As Table |
Parameters
- tableToJoin
- Type: ESRI.ArcGISExplorer.Data..::.Table
The Table to join to the current table instance.
- originKeyColumnName
- Type: System..::.String
The name of the origin key column in the current table instance.
- originForeignKeyColumnName
- Type: System..::.String
The name of the origin foreign key column in the tableToJoin.
- joinType
- Type: ESRI.ArcGISExplorer.Data..::.TableJoinType
One of the TableJoinType values which determines whether all or only the matching rows in the joined table will be returned.
Return Value
A new Table object which is the result of joining the tables.Remarks
Joins can only be performed where the relationship Cardinality is one-to-one. Performance will be improved if the columns participating in the join are indexed. When accessing columns in the joined table by name, use the fully qualified form: "table_name.column_name". This is a convenience method to join two tables; for more advanced options use one of the TableRelationship.CreateJoinedTable methods.
Examples
The code below performs an in-memory join between a feature class and a table using the Join method then iterates over all
the rows in the joined table.
CopyC#
//Open Montgomery file geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Montgomery.gdb"); //Open the parcels feature class Table parcels = gdb.OpenTable("parcels"); //Open the owners table Table owners = gdb.OpenTable("owners"); //Join the owners table to the parcels table (the cardinality is 1:1) Table parcelsOwners = parcels.Join(owners, "PROPERTY_I", "PROPERTY_ID", TableJoinType.KeepOnlyMatchingRows); //Return all the rows in the joined table printing out the 'parcel_id' value from //the parcels feature class and the 'owner_name' value from the owners table. foreach (Row joinedRow in parcelsOwners.GetRows()) { string output = string.Format("Parcel ID = {0}, Owner = {1}", joinedRow.Values["parcels.parcel_id"], joinedRow.Values["owners.owner_name"]); System.Diagnostics.Debug.Print(output); }
CopyVB.NET
'Open Montgomery file geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Montgomery.gdb") 'Open the parcels feature class Dim parcels As Table = gdb.OpenTable("parcels") 'Open the owners table Dim owners As Table = gdb.OpenTable("owners") 'Join the owners table to the parcels table (the cardinality is 1:1) Dim parcelsOwners As Table = parcels.Join(owners, "PROPERTY_I", "PROPERTY_ID", TableJoinType.KeepOnlyMatchingRows) 'Return all the rows in the joined table printing out the 'parcel_id' value from 'the parcels feature class and the 'owner_name' value from the owners table. For Each joinedRow As Row In parcelsOwners.GetRows() Dim output As String = String.Format("Parcel ID = {0}, Owner = {1}", joinedRow.Values.Item("parcels.parcel_id"), _ joinedRow.Values.Item("owners.owner_name")) System.Diagnostics.Debug.Print(output) Next