RelateInfo

A class that contains a relationship that a table or layer participates in.

Property

Type

Description

Cardinality

esriRelCardinality

Cardinality for the relationship

IsComposite

bool

Indicates if the relationship class represents a composite relationship in which the origin object class represents the composite object

KeyField

string

Key field of the table related to

KeyFieldInRelationshipTable

string

Key field in Relationship Table

Name

string

Name of the relationship from the view point of the table.

RelationshipID

int

The unique identifier of the relationship class in the geodatabase. For a relationship between two tables, it is unique in the service.

RelatedTableID

int

Id of the related layer or table.

RelationshipTableId

int

Id of table that maintains the relationhip information between the source and destination table

Role

esriRelRole

Role of this table in the relationship

Remarks

Use MapServerInfo to get the list of MapLayerInfo or StandaloneTableInfo available to the map. If a layer or a table participates in a relationship, MapServer advertises that by populating that information as this object.

When there are more than one relationships exist between the same source and destination table(s) or layer(s), RelationshipID can be used to uniquely identify a relationship.

In order for MapServer to advertise a relationship, both source and destination layer/standalone table must be added to the source map document.

Feature service example of the name of the relationship from the table's point of view given below.

If there is a relationship between Parcel and Owner tables, Relationship name in Parcel table will be "OwnedBy" and in Owner table it will be "Owns".

These names are obtained from geodatabase relationship class as follows: Name of Relate for an Origin Table is RelationshipClass' Forward label. Name of Relate for a destination Table is ReleationshipClass' Backward label.

Examples

C#

//Example: Printing a list of all relates a layer or table is participating in.

//Assuming pMTI is a MapTabeInfo passed in to this function.

 

MapServerWS.RelateInfo[] pRIs = null;

MapServerWS.RelateInfo pRI = null;

if (pMTI is MapServerWS.StandaloneTableInfo)

{

      MapServerWS.StandaloneTableInfo pSTI = (MapServerWS.StandaloneTableInfo)pMTI;

      pRIs = pSTI.RelateInfos;

}

else if (pMTI is MapServerWS.MapLayerInfo)

{

      MapServerWS.MapLayerInfo pMLI = (MapServerWS.MapLayerInfo)pMTI;

      pRIs = pMLI.RelateInfos;

}

if (pRIs == null)

{

      Console.WriteLine("No relationship is available");

      return;

}

 

for (int j = 0; j < pRIs.Length; j++)

{

      pRI = pRIs[j];

      Console.WriteLine(pRI.Name + ", " + pRI.RelationshipID + ", " + pRI.RelatedTableID + "\n");

}

10/23/2013