<?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: Join ignores the DefinitionExpression in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576171#M15533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could anybody solve the problem???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it doesn't work, I must copy the filtered data into a temporary table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Feb 2013 05:19:10 GMT</pubDate>
    <dc:creator>InesImkamp</dc:creator>
    <dc:date>2013-02-27T05:19:10Z</dc:date>
    <item>
      <title>Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576166#M15528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I wrote the following code to get a FeatureClass with legend information corresponding to the map sheet (for example "TK=1234").&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But the result of the join doesn't care of the DefinitionExpression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I do the same in ArcMap the result is how I expected. But programmatically &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 1. add a FeatureLayer from a FileGeoDatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureClass fcGeol = MyTools.LoadFeatureClass("FileGDB", sPath, "Geologische_Karten.gdb", sLayername);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureLayer2 flyrGeol = new FeatureLayerClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;flyrGeol.FeatureClass = fcGeol;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ILayer lyrGeol = (ILayer)flyrGeol;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lyrGeol.Name = sLayername;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;currentMap.AddLayer(lyrGeol);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 2. add Table "Legenden" from "\Schichtenkatalog.mdb"ITable tabLegenden = MyTools.LoadTable("Access", sPath + "\\GeolLayers.mdb", "Legenden");&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IStandaloneTable staloneTabLegenden = new StandaloneTableClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;staloneTabLegenden.Table = tabLegenden;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;staloneTabLegenden.Name = "Legenden";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 3. set the DefinitionQuery !!!ITableDefinition tabdefLegenden = staloneTabLegenden as ITableDefinition;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tabdefLegenden.DefinitionExpression = "Legenden.TK = 1234";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 4. add the Table "Legenden" to the StandaloneTableCollectionIStandaloneTableCollection standaloneTabColl = currentMap as IStandaloneTableCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;standaloneTabColl.AddStandaloneTable(staloneTabLegenden);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 5. join the Table "Legenden" to the FeatureClassIDisplayRelationshipClass dispRelClass = flyrGeol as IDisplayRelationshipClass;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// create an InMemory-RelationshipClass-Objekt&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Type t = Type.GetTypeFromProgID("esriGeodatabase.MemoryRelationshipClassFactory");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memrelFactory = Activator.CreateInstance(t) as IMemoryRelationshipClassFactory;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IRelationshipClass relationshipClass = memrelFactory.Open("Relation1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; (IObjectClass)fcGeol, "KOMBINR", (IObjectClass)staloneTabLegenden.Table, "KOMBINR",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dispRelClass.DisplayRelationshipClass(relationshipClass, esriJoinType.esriLeftOuterJoin);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 5(b). attempt with DisplayTableIDisplayTable pDisplayTableLegend = staloneTabLegenden as IDisplayTable;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IRelationshipClass relationshipClass = memrelFactory.Open("Relation1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; (IObjectClass)fcGeol, "KOMBINR", (IObjectClass)pDisplayTableLegend.DisplayTable, "KOMBINR",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dispRelClass.DisplayRelationshipClass(relationshipClass, esriJoinType.esriLeftOuterJoin);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I get the join to notice my DefinitionExpression?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your replies in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Ines&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2013 13:05:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576166#M15528</guid>
      <dc:creator>InesImkamp</dc:creator>
      <dc:date>2013-02-18T13:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576167#M15529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It looks to me like you're performing the join backwards.&amp;nbsp; In the Open() method, you pass in the table reference and its key field name first, followed by the feature class reference and its key field name.&amp;nbsp; This joins the table to the feature class.&amp;nbsp; Also, it looks like you're setting the definition query on the table?&amp;nbsp; Shouldn't you be setting it on the feature layer?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:22:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576167#M15529</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-02-19T17:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576168#M15530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil, thanks for reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;It looks to me like you're performing the join backwards. In the Open() method, you pass in the table reference and its key field name first, followed by the feature class reference and its key field name. This joins the table to the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried to pass the table reference in the Open() method first:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IRelationshipClass relationshipClass = memrelFactory.Open("Relation1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; (IObjectClass)staloneTabLegenden.Table, "KOMBINR", (IObjectClass)fcGeol, "KOMBINR",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But the result is the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-style:italic;"&gt;Also, it looks like you're setting the definition query on the table? Shouldn't you be setting it on the feature layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have to set the definition query on the table, because the table contains the legend information for different feature classes. There are different TK with the same KOMBINR.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With the definition query I try to filter the TK of the current feature class (for instance TK=1234) and then I join the filtered table to the feature class. But in the result there are any TK, may be the first available, joined to the feature class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The tables DefinitionExpression has no effect on the join result.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 11:07:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576168#M15530</guid>
      <dc:creator>InesImkamp</dc:creator>
      <dc:date>2013-02-20T11:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576169#M15531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Outline step by step what you have to do through the ArcMap UI in order to accomplish what you're wanting to do and I'll see if I can translate that to code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Feb 2013 12:59:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576169#M15531</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-02-20T12:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576170#M15532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here are the steps I would like to perform:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Add a feature class (one of several map sheets) to the map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. Add a table with legend informations (of all map sheets) to the StandaloneTableCollection.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Reduce the data in the table to the information for the current map sheet (Legenden.TK=...).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Join the reduced data to the feature class.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 07:17:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576170#M15532</guid>
      <dc:creator>InesImkamp</dc:creator>
      <dc:date>2013-02-21T07:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576171#M15533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Could anybody solve the problem???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If it doesn't work, I must copy the filtered data into a temporary table.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Feb 2013 05:19:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576171#M15533</guid>
      <dc:creator>InesImkamp</dc:creator>
      <dc:date>2013-02-27T05:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: Join ignores the DefinitionExpression</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576172#M15534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Now I found a solution for my problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Because I'm working with a personal geodatabase I can load the table "Legenden" with &lt;/SPAN&gt;&lt;STRONG&gt;IQueryName2&lt;/STRONG&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;STRONG&gt;IQueryDef&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 1. add a FeatureLayer from a FileGeoDatabase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureClass fcGeol = MyTools.LoadFeatureClass("FileGDB", sPath, "Geologische_Karten.gdb", sLayername);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureLayer2 flyrGeol = new FeatureLayerClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;flyrGeol.FeatureClass = fcGeol;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ILayer lyrGeol = (ILayer)flyrGeol;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lyrGeol.Name = sLayername;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;currentMap.AddLayer(lyrGeol);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// 2. load the table "Legenden" with &lt;/SPAN&gt;&lt;STRONG&gt;IQueryName2&lt;/STRONG&gt;&lt;SPAN&gt; and &lt;/SPAN&gt;&lt;STRONG&gt;IQueryDef&lt;/STRONG&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureWorkspace pFWS = MyTools.OpenAccessDbWorkspace(sDataPath, "GeolLayers.mdb") as IFeatureWorkspace;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IQueryDef pQueryDef = pFWS.CreateQueryDef();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryDef.Tables = "Legenden";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pQueryDef.WhereClause = "Legenden.KartArt='GK50' AND Legenden.TK = 1234";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IQueryName2 pQName = new TableQueryNameClass() as IQueryName2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pQName.QueryDef = pQueryDef;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// get a Name object for the Workspace&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDataset pDataset = (IDataset)pFWS;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IWorkspaceName pWSName = (IWorkspaceName)pDataset.FullName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// cast the TableQueryName to the IDatasetName and open it&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDatasetName pDSName = (IDatasetName)pQName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;pDSName.WorkspaceName = pWSName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IName pName = (IName)pQName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ITable pTable = (ITable)pName.Open();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// 3. add the Table to the StandaloneTableCollection&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IStandaloneTable staloneTabLegenden = new StandaloneTableClass();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;staloneTabLegenden.Table = pTable;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;staloneTabLegenden.Name = "Legenden";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IStandaloneTableCollection standaloneTabColl = currentMap as IStandaloneTableCollection;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;standaloneTabColl.AddStandaloneTable(staloneTabLegenden);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// 4. join the Table "Legenden" to the FeatureClass&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IDisplayRelationshipClass dispRelClass = flyrGeol as IDisplayRelationshipClass;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Type t = Type.GetTypeFromProgID("esriGeodatabase.MemoryRelationshipClassFactory");&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;memrelFactory = Activator.CreateInstance(t) as IMemoryRelationshipClassFactory;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IRelationshipClass relationshipClass = memrelFactory.Open("Relation1",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; (IObjectClass)staloneTabLegenden.Table, "KOMBINR", (IObjectClass)fcGeol, "KOMBINR",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;dispRelClass.DisplayRelationshipClass(relationshipClass, esriJoinType.esriLeftOuterJoin);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps somebody else.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 10:00:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/join-ignores-the-definitionexpression/m-p/576172#M15534</guid>
      <dc:creator>InesImkamp</dc:creator>
      <dc:date>2013-03-04T10:00:25Z</dc:date>
    </item>
  </channel>
</rss>

