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.

 View Only
  • 1.  nested arrays in Java read

    Posted Mon April 25, 2016 11:26 AM

    Hi guys
    Need your hint how to read and create and put the resulted object in pipeline
    It is a simple loop in Java , but I can not create it in flow:

    MyInputDataObject
    reults[reults[0], …results[20]]
    Each results Object contains few values. Example for results[0]: parameter1, parameter2,…parameter20 (name, age, year,… )

    MyOutputDataObject

    for each results{
    create new output
    output[i].a_parameter=parameter1
    output[i].b_parameter=parameter2
    ...
    for each results{
    create new child[j]
    output[i].childs[j].myParameterA=  parameter10
    output[i].childs[j].myParameterB=  parameter11
    ...
    }
    }
    

    brg
    Peter


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


  • 2.  RE: nested arrays in Java read

    Posted Mon April 25, 2016 12:45 PM

    Hi Peter,

    not sure if this is what you need:

    
    init empty output doc list
    Loop over your input
    1. init temp output doc
    2. map the direct parameters (a_parameter and b_parameter in your sample)
    3. init empty child doc list
    4. map the child parameters (myParameterA and myParameterB in your sample) to temp child doc
    5. add the temp child doc to child doc list
    6. drop temp child doc
    7. repeat steps 4. to 6. for all remaining matching child docs
    8. add child doc list to temp output doc
    9. add temp output doc to output doc list
    10. drop temp output doc
    End loop
    use output doc list for further mappings

    Regards,
    Holger


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


  • 3.  RE: nested arrays in Java read

    Posted Mon April 25, 2016 04:05 PM

    Hi Holger
    I do not need logical language or pseudo algorithm, I need it in IData and IDataCursor language :slight_smile:
    Can you put some code and show how to get Array from a Idata and loop over this Array object
    Example
    IDataCursor pipelineCursor= pipeline.getCursor();
    IData iputData= IDataUtil.getIData( pipelineCursor, "MyInputDataObject" );

    for ( int i= 0; i < iputData.length; i++ ) {
    //what and how ?
    for ( int j= 0; j < whatEver.length; j++ ) {
    //what and how ?
    }

    }

    ??


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


  • 4.  RE: nested arrays in Java read

    Posted Tue April 26, 2016 12:10 PM

    Hi Peter,

    you talked about flow service, not java service.

    Please take a look at the IntegrationServer JavaAPI Reference.
    Most likely the Class IDataUtil has some meaningful methods.

    Regards,
    Holger


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