ArcGIS Explorer Component Help |
Row..::.GetRelatedRows Method (TableRelationship) |
Row Class Example See Also |
Gets related rows from another table which are linked by the specified relationship.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public RowCollection GetRelatedRows( TableRelationship relationship ) |
Visual Basic (Declaration) |
---|
Public Function GetRelatedRows ( _ relationship As TableRelationship _ ) As RowCollection |
Parameters
- relationship
- Type: ESRI.ArcGISExplorer.Data..::.TableRelationship
A TableRelationship object which defines the relationship between two tables using a Column which is common to both. This relationship may either be a permanent geodatabase relationship class or a temporary, in-memory TableRelationship.
Return Value
A RowCollection object which contains a number of Row objects each of which represents a record in the Table.Remarks
To use this method a relationship must already be defined between two tables either in a
geodatabase relationship class or as an in-memory TableRelationship which can be created using the
CreateMemoryRelationship method.
Examples
The code below returns the name of the property owners (owners table) for the specified land parcel (parcels shapefile)
by creating an in-memory relationship between the two tables and then using the GetRelatedRows method.
CopyC#
DataDirectory dir = new DataDirectory(@"C:\Data\Montgomery"); //Open the parcels shapefile Table parcels = dir.OpenTable("parcels"); //Open the owners dBase table Table owners = dir.OpenTable("owners"); //Create an in-memory TableRelationship between the two tables TableRelationship rel = TableRelationship.CreateMemoryRelationship("MemParcelsOwners", parcels, "property_i", "property_i", owners, TableRelationshipCardinality.OneToMany); //Get a single parcel Row parcel = parcels.GetRow(3510); //The parcels table is related to the owners table through the MemParcelOwners in-memory TableRelationship. foreach (Row owner in parcel.GetRelatedRows(rel)) { //Print the names of the owners of this parcel System.Diagnostics.Debug.Print(owner.Values["owner_name"].ToString()); }
CopyVB.NET
Dim dir As DataDirectory = New DataDirectory("C:\Data\Montgomery") 'Open the parcels shapefile Dim parcels As Table = dir.OpenTable("parcels") 'Open the owners dBase table Dim owners As Table = dir.OpenTable("owners") 'Create an in-memory TableRelationship between the two tables Dim rel As TableRelationship = TableRelationship.CreateMemoryRelationship("MemParcelsOwners", parcels, "property_i", _ "property_i", owners, TableRelationshipCardinality.OneToMany) 'Get a single parcel Dim parcel As Row = parcels.GetRow(3510) 'The parcels table is related to the owners table through the MemParcelsOwners TableRelationship. For Each owner As Row In parcel.GetRelatedRows(rel) 'Print the names of the owners of this parcel System.Diagnostics.Debug.Print(owner.Values.Item("owner_name").ToString()) Next