We have ArcGIS Desktop 10.5 Standard and ArcGIS Server 10.5 Standard running on Windows Server 2012R2 Standard with Microsoft SQL Server 2012 (SP1) running on Windows servers.
I am trying to figure out if I can create a relationship class in our enterprise geodatabase between a feature class and a view or between a spatial view and a view.
I already have created a relationship class between a feature class (land parcels) and a table (landowners), however I would like to join some additional information stored in lookup tables to each table in the form of views and have another relationship class between those two views (spatial view for land parcels and non-spatial view for landowners). So, for now I have created a view for the landowners (which I have registered with the entrprise geodatabase) and have tried to create a M-N relationship class between the land parcels feature class and that landowners view, but I am getting the following error message: "Create Relationship Class: Failed to create the specified relationship class. Not supported on a view."
Any help would be highly appreciated.
Try Registering the View with Geodatabase and then create the Relationship Class:
Note: Will suggest creating a test view and experimenting with that first, before trying with the actual one.
Thanks for replying.
I have tried that already and I'm still getting the message below.
So, I have created a test non-spatial view for the landowners using the Create Database View tool. I have also registered that view with the enterprise gdb following the instructions at the link above. However, when I'm trying to create a M:N relationship class between the land parcels feature class and that view (they are both owned by the same enterprise gdb) either by right clicking and New > Relationship Class or by using the Create Rewlationship Class tool, I'm getting the message below after I click Finish/Ok.
Is there something I'm missing here? Is this do-able at all or should I think of a workaround?
Considering the above, I feel its not do-able then.
Registering a table with the geodatabase allows the table to participate in geodatabase functionality, such as adding subtypes to it, defining domains for fields in the table, and placing the table in a relationship class. If it is a spatial table (a feature class), you can also move it into a feature dataset so it can be used in topologies, networks, terrains, and other feature dataset constructs.
Registering a view with the geodatabase allows the view to be included in read-only feature services.
Also the link that I provided, mentions the above. So it seems that Views cannot participate in a Relationship Class in any scenario.
I did NOT have success with this. It appears that relationship classes cannot work with a view - which I have to believe is some technical limitation.
The table to relationship class tool works great for creating a many-to-many relationship when you have/want to manage an intermediate table between non-view objects.
I had this issue recently a 10.5 enterprise geodatabase and I called Esri tech support. The analyst was perplexed that I have existing relationships between spatial views and tables in a 10.2 enterprise geodatabase. The analyst said this should not be the case; relationship classes are not supported with a view.
I believe it comes down to how the views are created. We were still using 10.2 because we could create a spatial views with the old ArcSDE command line tools. With 10.5 you could register the view with a geoprocessing tool. But in 10.5 we can't use the relationships with the views.
The workaround was to use a python script (arcpy) every night to go from spatial view --> to feature class then rebuild relationships.
I have a nightly arcpy script that truncates and appends data from 1 source location to a destination location where a relationship class exists, but I do not need to rebuild the relationship for the relates to function properly. Just wondering if you really need to perform a nightly rebuild of the relationship after moving the data.
I wouldn't need to if I truncate and append. In mine I'm overwriting the existing feature class which requires me to rebuild the relationship. If i have to do it again I might go with truncate and append, but right now it works.
Just my two cents. Views can be registered with the geodatabase in 10.5.1 but it won't allow you to create relationship classes or put it in a feature dataset. However 10.2.2 can still be used to create a relationship class on a registered view.