Select to view content in your preferred language

Populate relationship class without using OIDs?

682
2
01-05-2012 04:23 AM
JohnFannon
Frequent Contributor
Hi

We have a M-M relationship class (with an intermediate table) and can only find documentation on populating this using origin and destination OIDs through IRelationshipClass.CreateRelationship.

The relationship class origin and destination primary and foreign keys are NOT using objectID, but another field within the tables. I would like if possible to populate the relationship using values from these fields instead of objectIDs.

Anyone know if this is possible and if there are any examples? I can't find many decent examples for populating relationship classes.

Cheers

John
0 Kudos
2 Replies
sapnas
by
Frequent Contributor
Have you tried using IMemoryRelationshipClassFactory? Check out the below link for the sample code
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//002500000n8v000000
0 Kudos
JohnFannon
Frequent Contributor
For reference - I've managed to find a way to do this.

As the relationship class is m-m and therefore the relationship has an intermediate table, I can query interface to get an ITable from the IRelationshipClass and then simply insert new relationships using ITable methods such as CreateRow(), SetValue() and Store(). As I thought, this performs much better than IRelationshipClass.CreateRelationship.

Hope that helps someone else out.

John
0 Kudos