AnsweredAssumed Answered

Sort a table on multiple fields

Question asked by geonetadmin on Apr 14, 2010
Original User: rgutierrez@argongra.es
Original Date: 2010-04-14T04:16:41-0600

Hello,

I'm developing an application with ArcObjects in Java which needs to sort a table on multiple fields before processing all its rows.

If I don't previously sort the table, everything works fine:

ITable table = ((Workspace)workspace).openTable("TGIDOMS");

ICursor cursor = table.ITable_search(new QueryFilter(),false);

IRow row = cursor.nextRow();
while (row != null ) {
// code...
row = cursor.nextRow();
}

But, if I use TableSort to sort the table, the application crashes!

AutomationException: Unspecified error

This is the piece of the code where I sort the table:

TableSort pTableSort = new TableSort();
pTableSort.setFields("NOM_DOMINIO, NOM_TABLA");
pTableSort.setAscending("NOM_DOMINIO",true);
pTableSort.setAscending("NOM_TABLA",true);
pTableSort.setTableByRef(table);
pTableSort.sort(new TrackCancel());

ICursor cursor = pTableSort.getRows();

IRow row = cursor.nextRow();
while (row != null ) {
// code...
row = cursor.nextRow();
}

Could you give me any hints to understand what is hapenning?

Thanks in advance!

Rebeca Gutiérrez

Attachments

Outcomes