Below is the Java code for sorting the Numerical values from doclist.actually my requirement is i need to get all the fields in the doc list after sorting based on the sorting order in the target side.below code i am able get only sorting keyField.
is there any one have idea ,how to get the all fields from doclist based on the sorting keyfield?
For example in doclist has 3 fields cutomer id,name,address
in that keyField is customer id,in below the java service i am able to get only customer id based on the sorting order.i need to get remaning two fields ,based on the sorting order in the target side??
if any one have idea please suggest me to do this
IDataCursor idc = pipeline.getCursor();
IData documents = IDataUtil.getIDataArray(idc, “itemList”);
String fieldName = IDataUtil.getString(idc, “keyField”);
String strList = new String[documents.length];
long a=new long[strList.length];
for (int i=0; i < documents.length; i++)
{
IDataCursor dc = documents[i].getCursor();
strList[i] = IDataUtil.getString(dc, fieldName);
dc.destroy();
}
for (int i=0; i < documents.length; i++)
{
a[i]=Long.parseLong(strList[i]);
}
Arrays.sort(a);
String k[]=new String[a.length];
for (int j=0; j<a.length; j++)
{
k[j]=Long.toString(a[j]);
}
IDataCursor pipelineCursor_1 = pipeline.getCursor();
// op
IData op = new IData[k.length];
for (int j1=0;j1<k.length;j1++)
{
op[j1] = IDataFactory.create();
IDataCursor opCursor = op[j1].getCursor();
IDataUtil.put( opCursor, fieldName, k[j1] );
opCursor.destroy();
}
IDataUtil.put( pipelineCursor_1, “itemList”, documents );
pipelineCursor_1.destroy();