norberdo

Problem with IDisplayRelationshipClass

Discussion created by norberdo on Oct 12, 2012
Latest reply on Mar 26, 2014 by Knoche
I'm using IDisplayRelationshipClass to create join and delete join.. well, I try, because it's not working at all. Creating join causes deleting each others existing joins and creating new one. Here is my code:

IDisplayRelationshipClass displayRelationshipClass = _layer as IDisplayRelationshipClass;
                IMemoryRelationshipClassFactory memoryRelationshipClassFactory =
                    new MemoryRelationshipClassFactoryClass();

                IFeatureLayer featureLayer = pOriginLayer as IFeatureLayer;
                IObjectClass originObjectClass = featureLayer.FeatureClass;

                IFeatureLayer layerTojoin = pLayerToJoin as IFeatureLayer;
                IObjectClass objectClassToJoin = layerTojoin.FeatureClass;

                IRelationshipClass relationshipClass = memoryRelationshipClassFactory.Open(
                    "TabletoLayer",
                    objectClassToJoin,
                    pFieldToJoin.Name,
                    originObjectClass,
                    pOriginField.Name,
                    "forward",
                    "backward",
                    esriRelCardinality.esriRelCardinalityOneToOne);

                displayRelationshipClass.DisplayRelationshipClass(
                    relationshipClass,
                    pIsKeepAllRecordsChecked ? esriJoinType.esriLeftOuterJoin : esriJoinType.esriLeftInnerJoin);


Why it's not working? I'm doing exactly the same things as in thousands samples..

Outcomes