<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Pro SDK OpenRelationshipClass does not return results in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803287#M2046</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies for not answering this earlier. I spent some time investigating this today. As currently implemented, the OpenRelationshipClass() method only works with feature service databases. We will review this implementation in a future release to see if we can extend it to cover additional database types. And we’ll definitely clarify the documentation as soon as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a relationship class with an SDE or file geodatabase, you need to use the &lt;A href="http://prodev.arcgis.com/en/pro-app/sdk/api-reference/#topic7103.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Geodatabase.OpenDataset&amp;lt;RelationshipClass&amp;gt;&lt;/A&gt; method, passing in the name of the relationship class. If you don’t know the name of the relationship class you can find it and open it up using code like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IReadOnlyList&amp;lt;RelationshipClass&amp;gt; OpenRelationshipClass(Geodatabase geodatabase, string originClassName, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;string destinationClassName)
{
 List&amp;lt;RelationshipClass&amp;gt; relationshipClasses = new List&amp;lt;RelationshipClass&amp;gt;();

&amp;nbsp;IReadOnlyList&amp;lt;RelationshipClassDefinition&amp;gt; relationshipClassDefinitions = geodatabase.GetDefinitions&amp;lt;RelationshipClassDefinition&amp;gt;();
 foreach (RelationshipClassDefinition relationshipClassDefinition in relationshipClassDefinitions)
 {
 &amp;nbsp;&amp;nbsp;&amp;nbsp;if (relationshipClassDefinition.GetOriginClass() == originClassName &amp;amp;&amp;amp; relationshipClassDefinition.GetDestinationClass() == destinationClassName)
 &amp;nbsp;&amp;nbsp;&amp;nbsp;{
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;relationshipClasses.Add(geodatabase.OpenDataset&amp;lt;RelationshipClass&amp;gt;(relationshipClassDefinition.GetName()));
 &amp;nbsp;&amp;nbsp;&amp;nbsp;}
 &amp;nbsp;&amp;nbsp;&amp;nbsp;relationshipClassDefinition.Dispose();
 }
 return relationshipClasses;
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:56:11 GMT</pubDate>
    <dc:creator>RichRuh</dc:creator>
    <dc:date>2021-12-12T16:56:11Z</dc:date>
    <item>
      <title>ArcGIS Pro SDK OpenRelationshipClass does not return results</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803286#M2045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have been struggling with this issue for hours now and am wondering if anyone else has encountered this.&lt;/P&gt;&lt;P&gt;I have a feature class (&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;ADDRESS_MANAGER.GIS_INF_ADDRESS_P&lt;/CODE&gt;) and a table (&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;ADDRESS_MANAGER.GIS_TBL_ADDRESSCARD_B&lt;/CODE&gt;).&lt;/P&gt;&lt;P&gt;Using ArcCatalog, I have verified the IDs of the feature class is 987 and the address card table is 981. I have verified the relationship exists from the feature class to the address card table (&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;Relationship = ADDRESS_MANAGER.AddressCardHasAddress / Label = AddressCard / Origin=ADDRESS_MANAGER.GIS_INF_ADDRESS_P&lt;/CODE&gt;).&lt;/P&gt;&lt;P&gt;However, no relationship classes are returned when I run this code:&lt;/P&gt;&lt;PRE class="" style="color: #393318; background-color: #eff0f1; border: 0px; margin: 0px 0px 1em; padding: 5px;"&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit;"&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; sourceId &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; sourceTable&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;GetID&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;().&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;ToString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: 13px;"&gt;// returns "987"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;"&gt;var&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; destId &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; destTable&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;GetID&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;().&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;ToString&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;();&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: 13px;"&gt;// returns "981"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;IReadOnlyList&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;RelationshipClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; relationshipClasses &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; geodb&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;"&gt;OpenRelationshipClass&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;sourceId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt; destId&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"&gt;);&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I have verified the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;geodb&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;object does indeed point to the geodatabase that holds both of these layers -- geodb is set directly from the feature class. Both layer IDs are correct, and there is definitely a relationship class between them. I am porting old ArcObject code over that did something similar, and I cannot figure out how to actually get this RelationshipClass anymore without hardcoding a reference to it.&lt;/P&gt;&lt;P&gt;This is ran in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;QueuedTask.Run&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;per the documentation. Additionally, when I try to use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;geodb.OpenDataset&amp;lt;RelationshipClass&amp;gt;&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;with any sort of relationship name (either the qualified full name, full name, or alias) I get a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;ArcGIS.Core.Data.GeodatabaseCatalogDatasetException: The item was not found&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;exception. It doesn't seem to matter if I set up&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; padding: 1px 5px;"&gt;geodb&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;by opening the appropriate SDE file, or if I set it from the feature class (the geodb is an enterprise geodabatase -- Oracle)&lt;/P&gt;&lt;P&gt;This is in ArcGIS Pro 2.2 - using C# / .NET 4.6.2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2018 20:45:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803286#M2045</guid>
      <dc:creator>ThomasHorner</dc:creator>
      <dc:date>2018-08-27T20:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK OpenRelationshipClass does not return results</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803287#M2046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thomas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My apologies for not answering this earlier. I spent some time investigating this today. As currently implemented, the OpenRelationshipClass() method only works with feature service databases. We will review this implementation in a future release to see if we can extend it to cover additional database types. And we’ll definitely clarify the documentation as soon as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To open a relationship class with an SDE or file geodatabase, you need to use the &lt;A href="http://prodev.arcgis.com/en/pro-app/sdk/api-reference/#topic7103.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Geodatabase.OpenDataset&amp;lt;RelationshipClass&amp;gt;&lt;/A&gt; method, passing in the name of the relationship class. If you don’t know the name of the relationship class you can find it and open it up using code like the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;IReadOnlyList&amp;lt;RelationshipClass&amp;gt; OpenRelationshipClass(Geodatabase geodatabase, string originClassName, 
&amp;nbsp;&amp;nbsp;&amp;nbsp;string destinationClassName)
{
 List&amp;lt;RelationshipClass&amp;gt; relationshipClasses = new List&amp;lt;RelationshipClass&amp;gt;();

&amp;nbsp;IReadOnlyList&amp;lt;RelationshipClassDefinition&amp;gt; relationshipClassDefinitions = geodatabase.GetDefinitions&amp;lt;RelationshipClassDefinition&amp;gt;();
 foreach (RelationshipClassDefinition relationshipClassDefinition in relationshipClassDefinitions)
 {
 &amp;nbsp;&amp;nbsp;&amp;nbsp;if (relationshipClassDefinition.GetOriginClass() == originClassName &amp;amp;&amp;amp; relationshipClassDefinition.GetDestinationClass() == destinationClassName)
 &amp;nbsp;&amp;nbsp;&amp;nbsp;{
 &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;relationshipClasses.Add(geodatabase.OpenDataset&amp;lt;RelationshipClass&amp;gt;(relationshipClassDefinition.GetName()));
 &amp;nbsp;&amp;nbsp;&amp;nbsp;}
 &amp;nbsp;&amp;nbsp;&amp;nbsp;relationshipClassDefinition.Dispose();
 }
 return relationshipClasses;
}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps,&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:56:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803287#M2046</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2021-12-12T16:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK OpenRelationshipClass does not return results</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803288#M2047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the detailed response and corrective actions.&amp;nbsp; The code snippet is very useful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Sep 2018 15:18:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803288#M2047</guid>
      <dc:creator>ThomasHorner</dc:creator>
      <dc:date>2018-09-17T15:18:36Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK OpenRelationshipClass does not return results</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803289#M2048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the next release, Pro 2.3, anticipated in early 2019, we've changed Geodatabase.OpenRelationshipClass() so that it works with all geodatabase types, not just feature services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2018 21:37:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/803289#M2048</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2018-11-01T21:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK OpenRelationshipClass does not return results</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/1016061#M5979</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/114916"&gt;@RichRuh&lt;/a&gt;&amp;nbsp;How do I retrieve the relationship class from a feature class? I have a feature class that has a relationship class. I won't know the name of the relationship class or the name of the destination table. Is there a way to retrieve the&amp;nbsp;relationship class from a feature class that I am working with?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 18:41:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-openrelationshipclass-does-not/m-p/1016061#M5979</guid>
      <dc:creator>MarvisKisakye1</dc:creator>
      <dc:date>2021-01-12T18:41:52Z</dc:date>
    </item>
  </channel>
</rss>

