ArcGIS Explorer Component Help |
RowCollection..::.GetRelatedRows Method (TableRelationship) |
RowCollection 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 illustrates the GetRelatedRows method by finding all the rows which are related to the rows
in a RowCollection through a geodatabase relationship class.
CopyC#
{ //Open geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Forestry.gdb"); //Open file geodatabase feature class Table treeStandsTable = gdb.OpenTable("Stands"); //Open geodatabase relationship class TableRelationship relationship = gdb.OpenTableRelationship("StandsComponents"); //Find all tree stands in a specific area RowCollection treeStandRows = treeStandsTable.Search(new Filter("BLK=8")); //Specify a TableRelationship as the argument to the GetRelatedRows method in //order to find the rows in the Components table that are related to the rows //in the tree stands RowCollection. RowCollection componentRows = treeStandRows.GetRelatedRows(relationship); }
CopyVB.NET
'Open geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Forestry.gdb") 'Open file geodatabase feature class Dim treeStandsTable As Table = gdb.OpenTable("Stands") 'Open geodatabase relationship class Dim relationship As TableRelationship = gdb.OpenTableRelationship("StandsComponents") 'Find all tree stands in a specific area Dim treeStandRows As RowCollection = treeStandsTable.Search(New Filter("BLK=8")) 'Specify a TableRelationship as the argument to the GetRelatedRows method in 'order to find the rows in the Components table that are related to the rows 'in the tree stands RowCollection. Dim componentRows As RowCollection = treeStandRows.GetRelatedRows(relationship)