Hi guys,I'm doing a feature query on a geodata service in AGS 9.3.1 and I'm having some problems. What I want to do is limit the amount of records in each chunk. 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. Anyhow, what I want to do limit the records, unfortunately I keep getting errors.Basically what's going on is the application blows up if I don't specify rpi.setCount(4). It also blows up if the rpi.setCount() value is LESS THAN the number of records retrieved by the query. In the case of this particular query, there should be 5 results returned. If i setCount > 5 then it works fine.....but what if the query returns 6? What's going on here?
// 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());
// 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);