jeudi 26 mars 2015

How to create a relationship class between a feature layer and a standalone table


I need to create a join between a shapefile and a table that have been added to the map, the issue seems to be with the



memRelFact.Open("Table-Layer", (IObjectClass)fromTable, "TableFieldName"
+ featureClass, "FeatureClassFieldName", "FeatureClassName", "TableName"
+ esriRelCardinality.esriRelCardinalityOneToOne);


I can't figure out how to fix the issue, the error message is 'no overload method for 'Open' takes 6 arguments' here is the entire class code:



public void JoinTables()
{
//Define the feature class
IMxDocument mxDoc;
IMap map;
IFeatureLayer featureLayer;
IFeatureClass featureClass;
mxDoc = (IMxDocument)ArcMap.Application.Document;
map = mxDoc.FocusMap;
featureLayer = (IFeatureLayer)mxDoc.FocusMap.Layer[0];
featureClass = featureLayer.FeatureClass;

//Define the table to be joined
IStandaloneTableCollection tabCollection;
IStandaloneTable stTable;
ITable fromTable;
tabCollection = (IStandaloneTableCollection)map;
stTable = tabCollection.StandaloneTable[0];//census
fromTable = stTable.Table;

//Join the table to the feature class
IMemoryRelationshipClassFactory memRelFact;
IRelationshipClass relClass;
IDisplayRelationshipClass dispRC;
// Create a memory relationship class
// Cardinality is forward (origin to destination)
// Options are: OneToOne, OneToMany, ManyToMany
memRelFact = new MemoryRelationshipClassFactory();
relClass = memRelFact.Open("Table-Layer", (IObjectClass)fromTable, "TableFieldName"
+ featureClass, "FeatureClassFieldName", "FeatureClassName", "TableName"
+ esriRelCardinality.esriRelCardinalityOneToOne);
// Perform a join
dispRC = (IDisplayRelationshipClass)featureLayer;
dispRC.DisplayRelationshipClass(relClass, esriJoinType.esriLeftOuterJoin);
}




Aucun commentaire:

Enregistrer un commentaire