<?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: Trouble Selecting from FeatureLayer containing Definition Query in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834293#M3469</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Rich.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you are correct.&amp;nbsp; Exception&amp;nbsp;if "srch_lyr3.SetDefinitionQuery("");" not in place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll attempt to reproduce on a smaller scale, and submit as possible bug to technical support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 Apr 2018 11:46:30 GMT</pubDate>
    <dc:creator>MikeRatcliffe</dc:creator>
    <dc:date>2018-04-09T11:46:30Z</dc:date>
    <item>
      <title>Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834287#M3463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My&amp;nbsp;Definition Queried featurelayer clearly contains the field#&amp;nbsp;"Material;" however, my Select()&amp;nbsp;returns&amp;nbsp;the exception:&amp;nbsp; "&lt;SPAN style="color: #000000;"&gt;GeodatabaseFieldException," field does not exist or is unaccessible.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;The source FeatureLayer is a Complex Edge from a Geometric Network...(Problem?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;If I first remove the Definition Query from the FeatureLayer, the Select executes properly (Material = CI).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Select Method is supposed to drill through Definition Queries appropriately:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;"...&lt;/SPAN&gt;If there is a definition query set on the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/sdk/api-reference/topic11916.html" style="color: #1364c4; text-decoration: none;"&gt;MapMember&lt;/A&gt;, the Select() method will automatically work on the subset of rows in the MapMember that meet the definition criteria. You specify an additional query that will be applied after the MapMember's definition query by passing valid QueryFilter object for the QueryFilter parameter.&lt;BR /&gt;If the MapMember has any joins, this Select() method takes that into account.&lt;/P&gt;&lt;P style="margin-top: -6px;"&gt;To ensure maximum robustness, callers should explicitly dispose of the returned&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/sdk/api-reference/topic7630.html" style="color: #1364c4; text-decoration: none;"&gt;ArcGIS.Core.Data.Selection&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in either a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;using&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;statement or a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;finally&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;block."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Can someone point me in the right direction?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 16:11:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834287#M3463</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2018-04-04T16:11:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834288#M3464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I set up a similar situation and tried to reproduce your issue. &amp;nbsp;I have a map in Pro which contains a feature layer that points to a feature class that is a complex edge in a&amp;nbsp;geometric network. &amp;nbsp;The feature layer has a query definition set up on it (Phase Designation is Equal to 4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then wrote an add-in that grabbed that feature layer and executed a Select() and a Search() on that layer. &amp;nbsp;Both worked fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt;bool DoTest(Layer myLayer)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;FeatureLayer featureLayer = myLayer as FeatureLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;string definitionQuery = featureLayer.DefinitionQuery; // to confirm that it is set when stepping through debugger&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;// Create a query definition&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;QueryFilter queryFilter = new QueryFilter&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;WhereClause = "FEEDERID = 'GR-202'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;int searchCount = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;using (RowCursor cursor = featureLayer.Search(queryFilter))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (cursor.MoveNext())&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;searchCount++;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;using (Selection selection = featureLayer.Select(queryFilter, SelectionCombinationMethod.New))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;int selectcount = selection.GetCount();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;return true;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you send me some information about what you are trying to do? &amp;nbsp;If you are using a QueryFilter, is it possible that you are using the same field that appears in the definition query? &amp;nbsp;Could the layer definition be hiding the table field that you are trying to use?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&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, 05 Apr 2018 18:48:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834288#M3464</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2018-04-05T18:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834289#M3465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The FeatureLayer represents water mains, Definition Queried by DATASET = ABANDONED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a sequence of step that lead to the issue:&lt;/P&gt;&lt;P&gt;1. Grab the search layer from the active map&lt;/P&gt;&lt;P&gt;2. Populate a list of field names from it using List&amp;lt;FieldDescription&amp;gt;.&amp;nbsp; (I am absolutely making available the same field from the Definition Query to the user, which is "DATASET.")&lt;/P&gt;&lt;P&gt;3. User selects which field to search/select. Based on selected field, it is routed to an appropriate whereclause and fieldtype for conversion that sets up the actual feature selection.&lt;/P&gt;&lt;P&gt;4. DATASET = Abandoned is a CodedValueDomain.&amp;nbsp; Fields with CodedValueDomains are sent to an IList&amp;lt;string&amp;gt; of codedvaluepairs.values, which are then selectable by the user.&lt;/P&gt;&lt;P&gt;5. Finally, a spatialqueryfilter is applied to a FeatureLayer Select().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I do not SetDefinitionQuery("");&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/tags/#/?tags=select%28%29" style="color: #000000; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;select()&lt;/A&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;nbsp;returns&amp;nbsp;the exception:&amp;nbsp; "&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff; border: 0px;"&gt;&lt;A _jive_internal="true" href="https://community.esri.com/tags/#/?tags=geodatabasefieldexception" style="color: #287433; background-color: transparent; border: 0px; font-weight: inherit; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;geodatabasefieldexception&lt;/A&gt;," field does not exist or is inaccessible.&amp;nbsp; *I get this exception when trying to select out of any fieldtype (string, integer, CodedValueDomain, etc.).&amp;nbsp; *Seems none of the table fields are&amp;nbsp;accessible through the Definition Query.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I grab the DefinitionQuery before setting it to nothing, and re-instate it after the selection, the features are selected without the original DefinitionQuery, but show VISUALLY as you'd expect with the DefinitionQuery intact. (cheating).&amp;nbsp; Not what I need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 19:31:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834289#M3465</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2018-04-05T19:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834290#M3466</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Could you send me a short code snippet showing me how you are building the WhereClause and other properties of the QueryFilter that you are passing into FeatureLayer.Select()?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2018 20:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834290#M3466</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2018-04-05T20:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834291#M3467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;P&gt;.cs provided (not necessarily short...)&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2018 12:16:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834291#M3467</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2018-04-06T12:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834292#M3468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mike,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked through your&amp;nbsp;code and haven't found anything obviously wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My understanding from our conversation&amp;nbsp;above is that if this line is present the code works, and if it is commented out the call to FeatureLayer.Select() throws an exception:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace; color: #0000ff;"&gt;srch_lyr3.SetDefinitionQuery(""); &amp;nbsp;&lt;/SPAN&gt; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this true? &amp;nbsp;If so, that would seem to be a bug, but I cannot reproduce it to be sure. &amp;nbsp;It's not a generic problem with the API, but could be some combination of your database and map. &amp;nbsp;At this point, your best approach is to submit this to technical support. &amp;nbsp;They'll probably want a data sample and a smaller code sample that demonstrates the problem. I'll contact our liaison with technical support to let them know they can work with me on this issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry I cannot help more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2018 22:49:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834292#M3468</guid>
      <dc:creator>RichRuh</dc:creator>
      <dc:date>2018-04-06T22:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834293#M3469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Rich.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, you are correct.&amp;nbsp; Exception&amp;nbsp;if "srch_lyr3.SetDefinitionQuery("");" not in place.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll attempt to reproduce on a smaller scale, and submit as possible bug to technical support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2018 11:46:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834293#M3469</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2018-04-09T11:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Trouble Selecting from FeatureLayer containing Definition Query</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834294#M3470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;The issue was with my handling of SQL Syntax in the whereclause for the queryfilter.&amp;nbsp; When a codedvalue data type is String, the value must be enclosed in SINGLE QUOTES.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;failed syntax:&amp;nbsp;&amp;nbsp;WhereValue = Form1.GVar.ms_attfn + Form1.GVar.Oper8tr + Form1.GVar.ms_v;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN style="color: #4c4c4c;"&gt;&amp;nbsp;proper syntax: WhereValue&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c;"&gt;= Form1.GVar.ms_attfn + Form1.GVar.Oper8tr + "'" + Form1.GVar.ms_v + "'";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2018 13:42:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/trouble-selecting-from-featurelayer-containing/m-p/834294#M3470</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2018-04-19T13:42:37Z</dc:date>
    </item>
  </channel>
</rss>

