<?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 Error creating attributed relationship class in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1079189#M20350</link>
    <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I have created a code that duplicates feature classes and tables and then duplicates the existing relationships between them.&lt;/P&gt;&lt;P&gt;This is the workflow:&lt;BR /&gt;1. duplicate fcl and tables&lt;BR /&gt;2. for each fcl or table I copy the information of the relationship&lt;BR /&gt;3. than I create the relationships for the duplicate fcl or table using the following code&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;IFields campiAttributed = null;&lt;BR /&gt;if (relationshipEsistente.IsAttributed)&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;ITable table = (AttributedRelationshipClass)relationshipEsistente as ITable;&lt;BR /&gt;&lt;STRONG&gt;campiAttributed&lt;/STRONG&gt; = table.Fields;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ee)&lt;BR /&gt;{ }&lt;BR /&gt;}&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IRelationshipClass relClass = featureWorkspace.CreateRelationshipClass&lt;BR /&gt;(nomeRelazione, (IObjectClass)featureWorkspace.OpenTable(nome + "__" + nomeTabellaOrig),&lt;BR /&gt;(IObjectClass)featureWorkspace.OpenTable(nome + "__" + nomeTabellaDest), relationshipEsistente.ForwardPathLabel, relationshipEsistente.BackwardPathLabel,&lt;BR /&gt;relationshipEsistente.Cardinality, relationshipEsistente.Notification, relationshipEsistente.IsComposite, relationshipEsistente.IsAttributed, &lt;STRONG&gt;campiAttributed&lt;/STRONG&gt;,&lt;BR /&gt;relationshipEsistente.OriginPrimaryKey, relationshipEsistente.DestinationPrimaryKey, relationshipEsistente.OriginForeignKey, relationshipEsistente.DestinationForeignKey);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The problem is this, the 1:1 and 1:N relationship are replicated correctly, the&lt;STRONG&gt; attributed relationship N:M&lt;/STRONG&gt; with additional attributes is created correctly but is empty. I found out this problem because I can't navigate between objects in the fcl and table, than I inspected the relationship with the tool Make Query Table (Data Management) and it is empty.&lt;/P&gt;&lt;P&gt;Should I use an alternative way?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jul 2021 13:45:55 GMT</pubDate>
    <dc:creator>AlvaroA</dc:creator>
    <dc:date>2021-07-15T13:45:55Z</dc:date>
    <item>
      <title>Error creating attributed relationship class</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1079189#M20350</link>
      <description>&lt;P&gt;Hello everyone,&lt;BR /&gt;I have created a code that duplicates feature classes and tables and then duplicates the existing relationships between them.&lt;/P&gt;&lt;P&gt;This is the workflow:&lt;BR /&gt;1. duplicate fcl and tables&lt;BR /&gt;2. for each fcl or table I copy the information of the relationship&lt;BR /&gt;3. than I create the relationships for the duplicate fcl or table using the following code&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;IFields campiAttributed = null;&lt;BR /&gt;if (relationshipEsistente.IsAttributed)&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;ITable table = (AttributedRelationshipClass)relationshipEsistente as ITable;&lt;BR /&gt;&lt;STRONG&gt;campiAttributed&lt;/STRONG&gt; = table.Fields;&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ee)&lt;BR /&gt;{ }&lt;BR /&gt;}&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;IRelationshipClass relClass = featureWorkspace.CreateRelationshipClass&lt;BR /&gt;(nomeRelazione, (IObjectClass)featureWorkspace.OpenTable(nome + "__" + nomeTabellaOrig),&lt;BR /&gt;(IObjectClass)featureWorkspace.OpenTable(nome + "__" + nomeTabellaDest), relationshipEsistente.ForwardPathLabel, relationshipEsistente.BackwardPathLabel,&lt;BR /&gt;relationshipEsistente.Cardinality, relationshipEsistente.Notification, relationshipEsistente.IsComposite, relationshipEsistente.IsAttributed, &lt;STRONG&gt;campiAttributed&lt;/STRONG&gt;,&lt;BR /&gt;relationshipEsistente.OriginPrimaryKey, relationshipEsistente.DestinationPrimaryKey, relationshipEsistente.OriginForeignKey, relationshipEsistente.DestinationForeignKey);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The problem is this, the 1:1 and 1:N relationship are replicated correctly, the&lt;STRONG&gt; attributed relationship N:M&lt;/STRONG&gt; with additional attributes is created correctly but is empty. I found out this problem because I can't navigate between objects in the fcl and table, than I inspected the relationship with the tool Make Query Table (Data Management) and it is empty.&lt;/P&gt;&lt;P&gt;Should I use an alternative way?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 13:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1079189#M20350</guid>
      <dc:creator>AlvaroA</dc:creator>
      <dc:date>2021-07-15T13:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Error creating attributed relationship class</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1079312#M20351</link>
      <description>&lt;P&gt;Hi, AlvaroA&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Fields object passed to the &lt;A href="https://resources.arcgis.com/en/help/arcobjects-net/componentHelp/index.html#//00250000032m000000" target="_self"&gt;relAttrFields&lt;/A&gt; parameter should not be an object retrieved from another class. If the new class is going to have the same fields as an existing class, cast the existing class' fields collection to the IClone interface, clone it, and use the cloned fields collection as input for this method.&lt;/P&gt;&lt;P&gt;Can be help you ?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 16:36:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1079312#M20351</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2021-07-15T16:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error creating attributed relationship class</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1086555#M20364</link>
      <description>&lt;P&gt;I used:&lt;/P&gt;&lt;P&gt;IClone cloneFields = table.Fields as IClone;&lt;BR /&gt;campiAttributed = cloneFields.Clone() as IFields;&lt;/P&gt;&lt;P&gt;And it works more efficently.&lt;/P&gt;&lt;P&gt;Than I filled the new relationship with as a copy of the existing one (manually) and now all works well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 09:35:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-creating-attributed-relationship-class/m-p/1086555#M20364</guid>
      <dc:creator>AlvaroA</dc:creator>
      <dc:date>2021-08-26T09:35:01Z</dc:date>
    </item>
  </channel>
</rss>

