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
Expand all | Collapse all

How to sort DocumentList using FlowService?

  • 1.  How to sort DocumentList using FlowService?

    Posted Fri March 16, 2007 09:42 AM

    Hi All,
    I have
    DocList
    Doc
    Name
    Age

    I want to sort this DocList using FlowService by order of Age
    I can do it by java service, but i dont want that.

    Thanks a lot


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 2.  RE: How to sort DocumentList using FlowService?

    Posted Fri March 16, 2007 06:34 PM

    Hi,

    There is no build in service for sorting…you have to write a java service for it…or you can build on the logic in flow too

    Regards,
    Pradeep


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 3.  RE: How to sort DocumentList using FlowService?

    Posted Fri March 16, 2007 07:58 PM

    Here is a sample how you can do it…

    input:
    itemList(document List)
    keyField(String)
    sortDecending(String)

    output:
    itemList(document List)
    sorted(String)

    IData[] sortedItemList = null; 
    
    // pipeline 
    IDataCursor pipelineCursor = pipeline.getCursor(); 
    IData[] itemList = IDataUtil.getIDataArray( pipelineCursor, "itemList" ); 
    String keyField = IDataUtil.getString( pipelineCursor, "keyField" ); 
    boolean sortDescending =  
    (Boolean.valueOf(IDataUtil.getString( pipelineCursor,  
    "sortDescending" ))).booleanValue(); 
    pipelineCursor.destroy(); 
    
    if(itemList != null) 
    { 
    sortedItemList =  
    IDataUtil.sortIDataArrayByKey(itemList,  
    keyField,  
    IDataUtil.COMPARE_TYPE_COLLATION,  
    null,  
    sortDescending); 
    } 
    
    // pipeline 
    pipelineCursor = pipeline.getCursor(); 
    IDataUtil.put( pipelineCursor,  
    "sorted", sortedItemList==null ? "false" : "true"); 
    pipelineCursor.destroy();

    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods