<?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: Getting Distinct Values - ArcGIS .NET SDK in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256049#M3019</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joe,&lt;/P&gt;&lt;P&gt;Great input, I left this out of my question but that is actually what we are already using for our work-around. You are correct that it is super fast and very efficient with system resources. It also doesn't appear to put any locks on the data even with the data added to the map which is nice and works well for us. We just wanted to know if there was an "esri approved methodology" out there. I'm going to guess not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Aug 2018 19:49:11 GMT</pubDate>
    <dc:creator>BradleyAndrick3</dc:creator>
    <dc:date>2018-08-29T19:49:11Z</dc:date>
    <item>
      <title>Getting Distinct Values - ArcGIS .NET SDK</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256047#M3017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have a workflow where we are building a search control to allow users to search through data in a custom application written with the ArcGIS .NET SDK. This is an offline application that uses mobile geodatabases (.geodatabase) to store and sync back when in a service area. We are allowing the user to select 3 things:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) a &lt;STRONG&gt;layer name&lt;/STRONG&gt; from a dropdown (this is easy to query the map for layers and add the names to the dropdown list)&lt;/P&gt;&lt;P&gt;2) a &lt;STRONG&gt;list of fields&lt;/STRONG&gt; from a dropdown (this is also easy as we can add this from the field list of each map layer and alter this list when the user selects a different layer name from the first dropdown)&lt;/P&gt;&lt;P&gt;3) &lt;SPAN style="color: #ff0000;"&gt;this is our problem:&amp;nbsp;&lt;SPAN style="color: #000000;"&gt;we would like to have a third dropdown that is populated with a &lt;STRONG&gt;list of distinct values&lt;/STRONG&gt; of the field that is selected.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;We need to be able to have something to the equivalent of SELECT DISTINCT, however, if we attempt to query the feature table (QueryFeaturesAsync) we can only add to the property of the where statement, which does not allow for the DISTINCT prefix to be added to our query parameters. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Additionally, we tried to sort through the result&amp;nbsp;that is returned for all results using "1=1" which returns a FeatureQueryResult&amp;nbsp;but this takes a &lt;EM&gt;very long time to return&lt;/EM&gt; - we have hundreds of thousands of records potentially being returned which we would then have to iterate&amp;nbsp;through each to get the values and add them to the list if they do not already exist in the list. This is very poor programming methodology and is &lt;EM&gt;way to slow&lt;/EM&gt; to be used in production.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;We noticed that the &lt;A href="https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm"&gt;REST Services API has a query parameter of returnDistinctValues&lt;/A&gt;. This is essentially what we need to use in the .NET sdk but it does not seem to exist. The ideal workflow would be to set a query parameter for the outFields to match our second dropdown value and then use the returnDistinctValues property set to 'true' to populate the third dropdown from the distinct results.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;This seems like a very basic task that we are able to run in the Enterprise GDB DBMS very easily and the returned list is very fast to complete.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Looking for some assistance on this. Is it possible? Are we just missing something?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Aug 2018 18:24:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256047#M3017</guid>
      <dc:creator>BradleyAndrick3</dc:creator>
      <dc:date>2018-08-27T18:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Distinct Values - ArcGIS .NET SDK</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256048#M3018</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if the Runtime team will like this approach, but the .geodatabase is just a SqLite database.&amp;nbsp; If you just need to get the values to populate a list you could use the System.Data.SQLite API.&amp;nbsp; I'm sure it will be a &lt;STRONG&gt;LOT&lt;/STRONG&gt; faster than trying to query the table and find the values.&amp;nbsp; Something along these lines&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;string&lt;/SPAN&gt; connectioString &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; $&lt;SPAN class="string token"&gt;"Data Source={filename}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;using&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SQLiteConnection connection &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;SQLiteConnection&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;connectioString&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;connection&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Open&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="keyword token"&gt;string&lt;/SPAN&gt; query &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Select Distinct(fieldname)from thetable"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;SQLiteCommand command &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;SQLiteCommand&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;query&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; connection&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; reader &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; command&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ExecuteReader&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="keyword token"&gt;while&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; reader&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Read&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uniqueValuesList&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;Add&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;reader&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;fieldname&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;ToString&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We do some direct queries of the table to get information about the replica in the GDB_Items table.&amp;nbsp; We do these queries before the table is open in the map so I am not sure if there would be an issue if you were doing when the .geodatabases where loaded into the map&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:37:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256048#M3018</guid>
      <dc:creator>JoeHershman</dc:creator>
      <dc:date>2021-12-11T12:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Getting Distinct Values - ArcGIS .NET SDK</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256049#M3019</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Joe,&lt;/P&gt;&lt;P&gt;Great input, I left this out of my question but that is actually what we are already using for our work-around. You are correct that it is super fast and very efficient with system resources. It also doesn't appear to put any locks on the data even with the data added to the map which is nice and works well for us. We just wanted to know if there was an "esri approved methodology" out there. I'm going to guess not.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2018 19:49:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/getting-distinct-values-arcgis-net-sdk/m-p/256049#M3019</guid>
      <dc:creator>BradleyAndrick3</dc:creator>
      <dc:date>2018-08-29T19:49:11Z</dc:date>
    </item>
  </channel>
</rss>

