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.  java service sorting numerical values in document list

    Posted Sat April 21, 2012 10:51 AM

    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();


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


  • 2.  RE: java service sorting numerical values in document list

    Posted Sat April 21, 2012 10:40 PM

    I’ve uploaded a package to the wMUsers Software section. It should be approved and available for download shortly. It provides what you’re looking for. It will be named ReList.zip (name might end up being modified by the board to add a sequence number).


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


  • 3.  RE: java service sorting numerical values in document list

    Posted Mon April 23, 2012 03:22 PM

    Thanks Reamon.once the ReList.zip package available for download in Software section,please let me know…


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


  • 4.  RE: java service sorting numerical values in document list

    Posted Mon April 23, 2012 08:33 PM

    Rob’s utility can be found in the wMUsers Software area. It should be the first one listed or you can search using the keyword “ReList”.

    Thanks, Rob!


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