ArcGIS Explorer Component Help |
Table..::.HasRelationships Property |
Table Class Example See Also |
Gets a value indicating whether the table participates in any relationships, which could either be permanent geodatabase
relationship classes or in memory table relationships.
Namespace:
ESRI.ArcGISExplorer.DataAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public bool HasRelationships { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property HasRelationships As Boolean |
Field Value
trueTruetruetrue (True in Visual Basic) if the Table participates in any relationships with other tables; otherwise, falseFalsefalsefalse (False in Visual Basic).Examples
The code below checks that the Properties feature class participates in relationships with other tables using the
HasRelationships property and then uses the GetTableRelationships method to discover the names of
associated relationships.
CopyC#
//Open a file geodatabase feature class called Properties Table properties = Table.OpenFileGeodatabaseTable(@"C:\Data\Property.gdb", "Properties"); //Determine whether the Properties table participates in any relationships if (properties.HasRelationships == true) { //Example 1 - print the names of all relationships that the Properties table participates in foreach (TableRelationship rel in properties.GetTableRelationships()) { System.Diagnostics.Debug.Print(rel.Name); } //Example 2 - print the names of the relationships that the Properties table participates in //where it acts as the origin in the relationship. foreach (TableRelationship rel in properties.GetTableRelationships(TableRelationshipRole.Origin)) { System.Diagnostics.Debug.Print(rel.Name); } //Example 3 - print the names of only the geodatabase relationships that the Properties table participates in //and where it acts as the origin in the relationship foreach (TableRelationship rel in properties.GetTableRelationships(TableRelationshipRole.Origin, TableRelationshipType.Geodatabase)) { System.Diagnostics.Debug.Print(rel.Name); } }
CopyVB.NET
'Open a file geodatabase feature class called properties Dim properties As Table = Table.OpenFileGeodatabaseTable("C:\Data\Property.gdb", "Properties") 'Determine whether the "Properties" table participates in any relationships If properties.HasRelationships = True Then 'Example 1 - print the names of all relationships that the "Properties" table participates in For Each rel As TableRelationship In properties.GetTableRelationships() System.Diagnostics.Debug.Print(rel.Name) Next 'Example 2 - print the names of the relationships that the "Properties" table participates in 'where it acts as the origin in the relationship. For Each rel As TableRelationship In properties.GetTableRelationships(TableRelationshipRole.Origin) System.Diagnostics.Debug.Print(rel.Name) Next 'Example 3 - print the names of only the geodatabase relationships that the "Properties" table participates in 'and where it acts as the origin in the relationship For Each rel As TableRelationship In properties.GetTableRelationships(TableRelationshipRole.Origin, TableRelationshipType.Geodatabase) System.Diagnostics.Debug.Print(rel.Name) Next End If