Select to view content in your preferred language

Show relates from destination layer/table

2792
0
09-10-2015 08:06 AM
FabianoFerrazza
Deactivated User

Hi all,

i need to know by arcobjects which other layers/tables are related throught relationship classes or throught relates to an other.

For relationship classes there are no problems.

For relates, if I query the origin layer is ok, but if i query the destination layer, the relate has not shown.

Here a little code example:

                 ILayer lay=ArcMap.Document.SelectedLayer;

            IRelationshipClassCollection relClasses = lay as IRelationshipClassCollection;

            IFeatureClass fc = ((IFeatureLayer)lay).FeatureClass;

            IEnumRelationshipClass enumRelC=relClasses.RelationshipClasses;

            enumRelC.Reset();

            IRelationshipClass relC = enumRelC.Next() as IRelationshipClass;

            if (relC == null)

            {

                MessageBox.Show("NoRel");

                return;

            }

            while (relC != null)

            {

                MessageBox.Show(relC.OriginClass.AliasName + " "+ relC.DestinationClass.AliasName);

                relC = enumRelC.Next() as IRelationshipClass;

            }

      

So, if the selected layer is the origin for relate, "OriginLay DestinationLay" has shown, if the selected is destination one, "NoRel" has shown instead.

Could you help me?

Thanks!

Fabiano

Tags (2)
0 Kudos
0 Replies