<?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: DISTINCT, ORDER BY, COUNT use in 10.1... in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500922#M13457</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What the query filter object does is build a SQL query using the property values you give it.&amp;nbsp; It looks something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT &amp;lt;subfields&amp;gt; FROM &amp;lt;tablename&amp;gt; WHERE &amp;lt;whereclause&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't parse the property values you give it - it simply puts them into the query.&amp;nbsp; Different data sources implement different flavors of SQL.&amp;nbsp; What works in one may or may not work in another.&amp;nbsp; The Subfields property is intended to be a simple list of field names.&amp;nbsp; The fact that you can also add keywords such DISTINCT is simply a byproduct of how the object creates the SQL queries.&amp;nbsp; Because it is not an intended use of the property, you should not include anything but field names in the list unless you can guarantee that your query will always execute against a data source that supports the keywords you are inserting.&amp;nbsp; If you need to perform queries that do more than what the query filter object supports then you shouldn't use it.&amp;nbsp; Instead, you can connect to the data source directly and execute the required queries (this is a non-ArcObjects approach).&amp;nbsp; You can also use ArcObjects classes, such as IDataStatistics and IQueryFilterDefinition, that are specifically written for additional query support.&amp;nbsp; There is also the IWorkspace.ExecuteSQL method which may be of some use in certain cases.&amp;nbsp; ISqlSyntax may also be used to build queries for specific data sources.&amp;nbsp; Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2013 12:46:25 GMT</pubDate>
    <dc:creator>NeilClemmons</dc:creator>
    <dc:date>2013-02-22T12:46:25Z</dc:date>
    <item>
      <title>DISTINCT, ORDER BY, COUNT use in 10.1...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500921#M13456</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Architecture is :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;10.1 SP1 java&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10.1 ArcMap&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;10.1 FGDB&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Implementing SOE in java.&amp;nbsp; Is it not possible to this with a 10.1 FGDB?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;//define the filter.
filter = new QueryFilter();
filter.setSubFields("DISTINCT " + CADASTRE_FIELD_NAME);
filter.setWhereClause(PROV_FIELD_NAME + " = '" + province + "'");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I am trying to do is run a particular query off a map service.&amp;nbsp; I could do this with using SDE, but seems it's crapping out when I swapped it out for FGDB.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How do you accomplish this task?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Feb 2013 19:58:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500921#M13456</guid>
      <dc:creator>BillZborowski</dc:creator>
      <dc:date>2013-02-21T19:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCT, ORDER BY, COUNT use in 10.1...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500922#M13457</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What the query filter object does is build a SQL query using the property values you give it.&amp;nbsp; It looks something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SELECT &amp;lt;subfields&amp;gt; FROM &amp;lt;tablename&amp;gt; WHERE &amp;lt;whereclause&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It doesn't parse the property values you give it - it simply puts them into the query.&amp;nbsp; Different data sources implement different flavors of SQL.&amp;nbsp; What works in one may or may not work in another.&amp;nbsp; The Subfields property is intended to be a simple list of field names.&amp;nbsp; The fact that you can also add keywords such DISTINCT is simply a byproduct of how the object creates the SQL queries.&amp;nbsp; Because it is not an intended use of the property, you should not include anything but field names in the list unless you can guarantee that your query will always execute against a data source that supports the keywords you are inserting.&amp;nbsp; If you need to perform queries that do more than what the query filter object supports then you shouldn't use it.&amp;nbsp; Instead, you can connect to the data source directly and execute the required queries (this is a non-ArcObjects approach).&amp;nbsp; You can also use ArcObjects classes, such as IDataStatistics and IQueryFilterDefinition, that are specifically written for additional query support.&amp;nbsp; There is also the IWorkspace.ExecuteSQL method which may be of some use in certain cases.&amp;nbsp; ISqlSyntax may also be used to build queries for specific data sources.&amp;nbsp; Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 12:46:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500922#M13457</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2013-02-22T12:46:25Z</dc:date>
    </item>
    <item>
      <title>Re: DISTINCT, ORDER BY, COUNT use in 10.1...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500923#M13458</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the response.&amp;nbsp; Using your suggestion I modified the code to read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
//define the filter.
filter = new QueryFilter();
filter.setSubFields(CADASTRE_FIELD_NAME);
filter.setWhereClause(PROV_FIELD_NAME + " = '" + province + "'");
&amp;nbsp;&amp;nbsp; 
IQueryFilterDefinition2 filterDefinition = (IQueryFilterDefinition2)filter;
filterDefinition.setPrefixClause("DISTINCT " + CADASTRE_FIELD_NAME);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I want to do it this way to avoid bringing another technology stack (Oracle/JNDI/etc) into the overall architecture if at all possible.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:59:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/distinct-order-by-count-use-in-10-1/m-p/500923#M13458</guid>
      <dc:creator>BillZborowski</dc:creator>
      <dc:date>2021-12-11T21:59:28Z</dc:date>
    </item>
  </channel>
</rss>

