<?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 IFeatureLayerDefinition2.DefinitionExpression does not accept long enough strings in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturelayerdefinition2-definitionexpression-does/m-p/673533#M18041</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My Environment&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt; &lt;BR /&gt; &lt;LI&gt;Visual Studio 2008&lt;/LI&gt; &lt;BR /&gt; &lt;LI&gt;ArcObjects 10.0&lt;/LI&gt; &lt;BR /&gt; &lt;LI&gt;VB.NET&lt;/LI&gt; &lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;I'm using IFeatureLayerDefinition2.DefinitionExpression, and nothing else on that interface.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer i'm using it on is a polygon layer with 600,000 features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer's ITable has ONLY 2 FIELDS ... Shape and ObjectID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is the IFeatureLayerDefinition interface does not allow for supplying a table of values to use for the DefinitionExpression. Instead it ONLY accepts a string, probably because ESRI incorrectly assumed that people would only need to use a short fancy simple text string in order to specify the expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adding additional attribute fields to this layer's ITable is NOT an option, nor is joining the ITable to a Sql Table, because the performance is horrific (that's what I originally tried). You'll wait several minutes for an expression that results in only a handful of features, because of a bug in ArcEngine 10 that tries to send a billion sql queries to sql server in order to figure out what you're looking for. I already successfully identified a similar bug in ArcObjects in version 9.3 and it was accepted as a bug by ESRI. I have yet to submit this one, but will get around to it at some point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I need to be able to specify 5,000+ ObjectID's in my expression, but since the DefinitionExpression is simply a string, it tops out at some unknown length. It will return all values up to that length, but after that, nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to be able to do this with 5,000+ ObjectID's&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureLayerDefinition.DefinitionExpression = "OBJECTID IN (100000, 100001, 100002, 100003, 100004&lt;/SPAN&gt;&lt;STRONG&gt;... and so on&lt;/STRONG&gt;&lt;SPAN&gt;)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how can I get around the string length limitation?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Feb 2013 06:11:01 GMT</pubDate>
    <dc:creator>ESRICustomer</dc:creator>
    <dc:date>2013-02-06T06:11:01Z</dc:date>
    <item>
      <title>IFeatureLayerDefinition2.DefinitionExpression does not accept long enough strings</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturelayerdefinition2-definitionexpression-does/m-p/673533#M18041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My Environment&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt; &lt;BR /&gt; &lt;LI&gt;Visual Studio 2008&lt;/LI&gt; &lt;BR /&gt; &lt;LI&gt;ArcObjects 10.0&lt;/LI&gt; &lt;BR /&gt; &lt;LI&gt;VB.NET&lt;/LI&gt; &lt;BR /&gt;&lt;/UL&gt;&lt;SPAN&gt;I'm using IFeatureLayerDefinition2.DefinitionExpression, and nothing else on that interface.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer i'm using it on is a polygon layer with 600,000 features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The layer's ITable has ONLY 2 FIELDS ... Shape and ObjectID&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is the IFeatureLayerDefinition interface does not allow for supplying a table of values to use for the DefinitionExpression. Instead it ONLY accepts a string, probably because ESRI incorrectly assumed that people would only need to use a short fancy simple text string in order to specify the expression.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Adding additional attribute fields to this layer's ITable is NOT an option, nor is joining the ITable to a Sql Table, because the performance is horrific (that's what I originally tried). You'll wait several minutes for an expression that results in only a handful of features, because of a bug in ArcEngine 10 that tries to send a billion sql queries to sql server in order to figure out what you're looking for. I already successfully identified a similar bug in ArcObjects in version 9.3 and it was accepted as a bug by ESRI. I have yet to submit this one, but will get around to it at some point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I need to be able to specify 5,000+ ObjectID's in my expression, but since the DefinitionExpression is simply a string, it tops out at some unknown length. It will return all values up to that length, but after that, nothing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to be able to do this with 5,000+ ObjectID's&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;IFeatureLayerDefinition.DefinitionExpression = "OBJECTID IN (100000, 100001, 100002, 100003, 100004&lt;/SPAN&gt;&lt;STRONG&gt;... and so on&lt;/STRONG&gt;&lt;SPAN&gt;)"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So how can I get around the string length limitation?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2013 06:11:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/ifeaturelayerdefinition2-definitionexpression-does/m-p/673533#M18041</guid>
      <dc:creator>ESRICustomer</dc:creator>
      <dc:date>2013-02-06T06:11:01Z</dc:date>
    </item>
  </channel>
</rss>

