In "Joining Data" in the help, the following code is given:// Build a memory relationship class.Type memRelClassFactoryType = Type.GetTypeFromProgID( "esriGeodatabase.MemoryRelationshipClassFactory");IMemoryRelationshipClassFactory memRelClassFactory = (IMemoryRelationshipClassFactory)Activator.CreateInstance(memRelClassFactoryType) ;IRelationshipClass relationshipClass = memRelClassFactory.Open("ParcelsOwners", parcelsFeatureClass, "PARCEL_ID", (IObjectClass)ownersTable, "PARCEL_ID", "Is Owned By", "Owns", esriRelCardinality.esriRelCardinalityOneToOne);But no explanation is provided for "ownersTable." What is it?I have created a QueryClass that implements the ITable interface and can be successfully casted to an ITable but that ITable cannot be casted to IObjectClass. What can be?
I believe it is the ITable to join to the IFeatureLayer. You need to replace OwnersTable with the Table in your implementation you wish to join to the target layer. What is the source table and FeatureLayer you want to join?
In the ESRI example they pass "OwnersTable" - what is that?
I think that you are attempting to Join the parcelsFeatureClass to the ownersTable in your code you posted. Is that what you want? Are you sure it shouldn't be the other way around? That is, you want to join the ownersTable to the parcelsFeatureClass. If so, it should be something like (this is VB.NET sorry):
pMemoryRelationshipClassFactory = New MemoryRelationshipClassFactory pRelationshipClass = pMemoryRelationshipClassFactory.Open("Join", ownersTable, TableFieldForJoin, pFeatureLayer.DisplayFeatureClass, LayerFieldForJoin, "forward", "backward", esriRelCardinality.esriRelCardinalityOneToOne)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.