<?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: Creating new Layer from joined table throws System.ArgumentException in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1325674#M10328</link>
    <description>&lt;P&gt;Just in case this is still pending...in my case I needed to switch to a LeftOuterJoin for the join type.&lt;/P&gt;</description>
    <pubDate>Tue, 05 Sep 2023 23:38:51 GMT</pubDate>
    <dc:creator>RobBlis</dc:creator>
    <dc:date>2023-09-05T23:38:51Z</dc:date>
    <item>
      <title>Creating new Layer from joined table throws System.ArgumentException</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1272337#M9577</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to create a new Layer from a table which is the result of a join between a FeatureClass and a table. I used the following example as a basis (specifically the "MakeJoin"-Function from "JoinsDockPaneViewModel.cs"):&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geodatabase/DynamicJoins" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Geodatabase/DynamicJoins&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;The FeatureClass comes from a file geodatabase, the table from a postgreSQL database that is not an enterprise geodatabase. My code looks like this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;private RelationshipClass MakeJoin(RelationshipClass relationshipClass, Table leftTable, Table rightTable, Field leftField, Field rightField, string layername)
{
    VirtualRelationshipClassDescription virtualRelationshipClassDescription = new VirtualRelationshipClassDescription(leftField, rightField, RelationshipCardinality.OneToOne);
    relationshipClass = leftTable.RelateTo(rightTable, virtualRelationshipClassDescription);
    JoinDescription joinDescription = new JoinDescription(relationshipClass)
    {
        JoinDirection = JoinDirection.Forward,
        JoinType = JoinType.InnerJoin,
        TargetFields = leftTable.GetDefinition().GetFields()
    };

    Join join = new Join(joinDescription);
    Table joinedTable = join.GetJoinedTable();
    if (joinedTable is FeatureClass)
    {
        FeatureClass joinedFc = (FeatureClass) joinedTable;

        FeatureLayerCreationParams layerParams = new FeatureLayerCreationParams(joinedFc);
        LayerFactory.Instance.CreateLayer&amp;lt;FeatureLayer&amp;gt;(layerParams, MapView.Active.Map);
    } 
    return relationshipClass;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At line 19 (CreateLayer) the following Exception occurs:&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;A user-supplied component or subscriber raised an exception (0x80040208)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;System.ArgumentException&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Quelle: ArcGIS.Desktop.Mapping&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;TargetSite: T MakeBasicServiceCall[T](System.Func`1[T])&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Stack:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Internal.Mapping.Utilities.MakeBasicServiceCall[T](Func`1 serviceCall)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Mapping.LayerCreationParams.CreateFromDataConnection(ILayerContainerEdit mapOrGroupLayer, Int32 index)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Mapping.LayerCreationParams.CreateLayer(ILayerContainerEdit mapOrGroupLayer, Int32 layerIndex)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Mapping.LayerFactory.CreateLayer[T](LayerCreationParams layerParams, ILayerContainerEdit container)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;InnerException:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;A user-supplied component or subscriber raised an exception (0x80040208)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;System.Runtime.InteropServices.COMException&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Quelle: ArcGIS.Desktop.Mapping&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;TargetSite: System.String AddData(ArcGIS.Desktop.Internal.Mapping.CreateLayerArgs ByRef, System.String)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Stack:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Internal.DesktopService._IMapAuthoringService.AddData(CreateLayerArgs&amp;amp; args, String dataConnectionXml)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Mapping.Map.&amp;lt;&amp;gt;c__DisplayClass316_0.&amp;lt;AddData&amp;gt;b__0()&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;at ArcGIS.Desktop.Internal.Mapping.Utilities.MakeBasicServiceCall[T](Func`1 serviceCall)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;The exception doesn't occur when I use two FeatureClasses to create the join. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Is there something that I'm missing in my code? Is there maybe another way to create a join with a FeatureLayer and a table? Using the Geoprocessing Tool is no option for me.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;I'm using the ArcGIS Pro SDK for .NET 3.1.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2023 09:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1272337#M9577</guid>
      <dc:creator>JFr87</dc:creator>
      <dc:date>2023-03-28T09:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new Layer from joined table throws System.ArgumentException</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1282681#M9730</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;does anyone have a guess about what I'm missing here? I'm stuck with this currently and I can't figure out why. Any help would be appriciated.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 06:11:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1282681#M9730</guid>
      <dc:creator>JFr87</dc:creator>
      <dc:date>2023-04-26T06:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Creating new Layer from joined table throws System.ArgumentException</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1325674#M10328</link>
      <description>&lt;P&gt;Just in case this is still pending...in my case I needed to switch to a LeftOuterJoin for the join type.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 23:38:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/creating-new-layer-from-joined-table-throws-system/m-p/1325674#M10328</guid>
      <dc:creator>RobBlis</dc:creator>
      <dc:date>2023-09-05T23:38:51Z</dc:date>
    </item>
  </channel>
</rss>

