IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
  • 1.  TN query - Orderby clause

    Posted Mon November 10, 2008 02:09 PM

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

    Best Regards,
    Prashant


    #B2B-Integration
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: TN query - Orderby clause

    Posted Mon November 10, 2008 02:40 PM

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

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

    Murali


    #Integration-Server-and-ESB
    #B2B-Integration
    #webMethods


  • 3.  RE: TN query - Orderby clause

    Posted Mon November 10, 2008 09:37 PM

    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


    #webMethods
    #Integration-Server-and-ESB
    #B2B-Integration