Sorting a Record List

I have tried to implement the sort by key described, the service compiles. I have the following code. My input is a document list called Transaction which has 3 variables (quantity, userstatus, and typename). I want to sort on the typename column. When I test the service my Transaction document list is the same no sort has occurred and the sort value is false. What am I missing?

IData sortedItemList = null;
// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
// Get Transactions
IData Transactions = IDataUtil.getIDataArray( pipelineCursor, “Transactions” );
String keyField = IDataUtil.getString( pipelineCursor, “typename” );
boolean sortDescending = false;
pipelineCursor.destroy();
if ( Transactions != null)
{
sortedItemList = IDataUtil.sortIDataArrayByKey(Transactions, keyField, IDataUtil.COMPARE_TYPE_COLLATION, null, sortDescending);
}
// pipeline
pipelineCursor = pipeline.getCursor();
IDataUtil.put( pipelineCursor, “sorted”, sortedItemList==null ? “false” : “true”);
pipelineCursor.destroy();

What value are you passing for the input parameter named “typename”?

It looks like you change the line from the original code:

String keyField = IDataUtil.getString( pipelineCursor, “keyField” );

to

String keyField = IDataUtil.getString( pipelineCursor, “typename” );

You probably don’t want to do that. Change that line of code back. Then you want to pass/set the keyField input parameter to “typename”.

Thanks that did it. It now works.