webMethods

 View Only
  • 1.  webmethods java services

    Posted Fri April 13, 2012 08:22 PM

    can any one know the method for converting IDataArray into StringArray and StringArray to IDataArray???


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


  • 2.  RE: webmethods java services

    Posted Fri April 13, 2012 10:05 PM

    Review pub.list:stringListToDocumentList in the docs.

    For the reverse, you’ll need something like:

    IDataCursor idc = pipeline.getCursor();
    IData[] documents = IDataUtil.getIDataArray(idc, "documents");
    String fieldName = IDataUtil.getString(idc, "fieldName");
    
    String[] strList = new String[documents.length];
    for (int i=0; i < documents.length; i++)
    {
    IDataCursor dc = documents[i].getCursor();
    strList[i] = IDataUtil.getString(dc, fieldName);
    dc.destroy();
    }
    IDataUtil.put(idc, "strList", strList);

    You could make this a bit more sophisticated with a fieldListType input but I’ll leave that to you if you want that.


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


  • 3.  RE: webmethods java services

    Posted Sat April 14, 2012 09:47 AM

    Thanks For your reply,your Coding working finee.For Sorting numeric values i used Array.sort it not wrking properly…for string only it works.


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


  • 4.  RE: webmethods java services

    Posted Mon April 16, 2012 04:01 PM

    This doesn’t do sorting.

    If you’re sorting the resulting string array, any sorting you’re doing is “working properly.” You’re sorting strings, not numbers. If you need a numeric sort you’ll need code that treats the elements as numeric types instead of strings. There are existing threads that cover this. Please search the forums.


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