TN query - Orderby clause

How can I give Orderby clause in TN queries created using wm.tn.query.createDocumentQuery. ?

Best Regards,
Prashant

Hi Prashant
By default, the results are in descending order.

If you still need ordering, you may have to write some java services.

Murali

Hi Prashant,

You have to create a query object, which is the output of wm.tn.query:createDocumentQuery. Then use a simple java service, infact use the method setSortColumn to set the column on which you want to order by. The valid values for the column are Date,Sender,Receiver, DocumentType.
Following java service might be helpful for you.

// pipeline
IDataCursor pipelineCursor = pipeline.getCursor();
Object query = IDataUtil.get( pipelineCursor, “query” );
String sortBy = IDataUtil.getString( pipelineCursor, “sortBy” );
pipelineCursor.destroy();
SimpleDocQuery query_tmp=(SimpleDocQuery)query;
if(sortBy!=null && sortBy!=“”)
query_tmp.setSortColumn(sortBy.trim(),false);
else
query_tmp.setSortColumn(“DocTimestamp”, false);
// pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
Object query_1 = new Object();
IDataUtil.put( pipelineCursor_1, “query”, query_tmp );
pipelineCursor_1.destroy();

Hope this helps

Regards,
Pradeep