<?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 Feature query and setting max records... in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/feature-query-and-setting-max-records/m-p/68285#M1836</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm doing a feature query on a geodata service in AGS 9.3.1 and I'm having some problems.&amp;nbsp; What I want to do is limit the amount of records in each chunk.&amp;nbsp; The default is set to 500, but since our test SDE is located on the other side of the country a query with large amounts of data simply takes too long.&amp;nbsp; Anyhow, what I want to do limit the records, unfortunately I keep getting errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically what's going on is the application blows up if I don't specify rpi.setCount(4).&amp;nbsp; It also blows up if the rpi.setCount() value is LESS THAN the number of records retrieved by the query.&amp;nbsp; In the case of this particular query, there should be 5 results returned.&amp;nbsp; If i setCount &amp;gt; 5 then it works fine.....but what if the query returns 6?&amp;nbsp; What's going on here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
// Step 1: establish connection to server.
ServerConnection conn = new ServerConnection();
conn.connect(AGSConstants.AGS_SERVER_URL);

// Step 2: Get reference to SOM.
IServerObjectManager som = conn.getServerObjectManager();

// Step 3: Get Map object reference.
IServerContext context = som.createServerContext("gdsCensusView", "GeoDataServer");
GeoDataServer gs = (GeoDataServer)context.getServerObject();
System.out.println(gs.getConfigurationName());
System.out.println(gs.getPhysicalOutputDirectory());
System.out.println(gs.getDefaultWorkingVersion());
&amp;nbsp; 
// Step 4: Perform a Query.
IQueryFilter qf = (IQueryFilter)context.createObject(QueryFilter.getClsid());
qf.setWhereClause("BARLEY_FARM_NUM = 40");
ResultPortionInfo rpi = (ResultPortionInfo)context.createObject(ResultPortionInfo.getClsid());
rpi.setCount(4);
rpi.setStartIndex(0);
IGDSQueryResultPortion resPortion = gs.tableSearch(gs.getDefaultWorkingVersion(), "TEST_VIEW", qf, rpi);
IRecordSet recs = resPortion.getRecords();
ICursor cursor = recs.getCursor(true);
IRow row;
int i = 0;
while ((row = cursor.nextRow()) != null) {
 System.out.println(row.getValue(0));
 System.out.println(row.getValue(1));
 ++i;
}
System.out.println("#####Record Count is " + i);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 May 2010 12:48:57 GMT</pubDate>
    <dc:creator>BillZborowski</dc:creator>
    <dc:date>2010-05-06T12:48:57Z</dc:date>
    <item>
      <title>Feature query and setting max records...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/feature-query-and-setting-max-records/m-p/68285#M1836</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi guys,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm doing a feature query on a geodata service in AGS 9.3.1 and I'm having some problems.&amp;nbsp; What I want to do is limit the amount of records in each chunk.&amp;nbsp; The default is set to 500, but since our test SDE is located on the other side of the country a query with large amounts of data simply takes too long.&amp;nbsp; Anyhow, what I want to do limit the records, unfortunately I keep getting errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically what's going on is the application blows up if I don't specify rpi.setCount(4).&amp;nbsp; It also blows up if the rpi.setCount() value is LESS THAN the number of records retrieved by the query.&amp;nbsp; In the case of this particular query, there should be 5 results returned.&amp;nbsp; If i setCount &amp;gt; 5 then it works fine.....but what if the query returns 6?&amp;nbsp; What's going on here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
// Step 1: establish connection to server.
ServerConnection conn = new ServerConnection();
conn.connect(AGSConstants.AGS_SERVER_URL);

// Step 2: Get reference to SOM.
IServerObjectManager som = conn.getServerObjectManager();

// Step 3: Get Map object reference.
IServerContext context = som.createServerContext("gdsCensusView", "GeoDataServer");
GeoDataServer gs = (GeoDataServer)context.getServerObject();
System.out.println(gs.getConfigurationName());
System.out.println(gs.getPhysicalOutputDirectory());
System.out.println(gs.getDefaultWorkingVersion());
&amp;nbsp; 
// Step 4: Perform a Query.
IQueryFilter qf = (IQueryFilter)context.createObject(QueryFilter.getClsid());
qf.setWhereClause("BARLEY_FARM_NUM = 40");
ResultPortionInfo rpi = (ResultPortionInfo)context.createObject(ResultPortionInfo.getClsid());
rpi.setCount(4);
rpi.setStartIndex(0);
IGDSQueryResultPortion resPortion = gs.tableSearch(gs.getDefaultWorkingVersion(), "TEST_VIEW", qf, rpi);
IRecordSet recs = resPortion.getRecords();
ICursor cursor = recs.getCursor(true);
IRow row;
int i = 0;
while ((row = cursor.nextRow()) != null) {
 System.out.println(row.getValue(0));
 System.out.println(row.getValue(1));
 ++i;
}
System.out.println("#####Record Count is " + i);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 May 2010 12:48:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/feature-query-and-setting-max-records/m-p/68285#M1836</guid>
      <dc:creator>BillZborowski</dc:creator>
      <dc:date>2010-05-06T12:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Feature query and setting max records...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/feature-query-and-setting-max-records/m-p/68286#M1837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is there nothing that can be done about this?&amp;nbsp; I'm not sure why this is occurring, as the few posts I've seen regarding geodata services seem to suggest it simply cuts off the query at pre-defined maximum.&amp;nbsp; What is the appropriate way to query a geodata service then?&amp;nbsp; I want to specify a query limit of, say, 150 records.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a tutorial somewhere?&amp;nbsp; Does anyone have any experience dealing with this?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 04:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/feature-query-and-setting-max-records/m-p/68286#M1837</guid>
      <dc:creator>BillZborowski</dc:creator>
      <dc:date>2010-05-12T04:19:52Z</dc:date>
    </item>
  </channel>
</rss>

