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

Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

  • 1.  Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Fri October 25, 2019 12:51 PM

    Hi WM Gurus,

    I created a JDBC adapter to get records from database table, then I use loop to go through the results. Then I try to append to a documentlist. But only the last record is appended repeatedly. Not sure what to do to append all records only once.

    Thank you for your help!

    Franky


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


  • 2.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Fri October 25, 2019 01:33 PM

    Hi Franky,

    Inputs will be your document list (toList) and your document (fromItem) and output will be your document list (toList). Can you provide a screen shot?

    -Mary


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


  • 3.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Fri October 25, 2019 01:45 PM

    Hi Franky,

    Addendum to Mary´s answer:
    Hopefully your JDBC results list is not the resulting document list.
    You should define a second doc list where you append to.

    I agree with Mary, that screenshot of your flow will be helpful for us for further assistance.

    Regards,
    Holger


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


  • 4.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Fri October 25, 2019 03:38 PM

    Hi Mary and Holger, thank you for your reply. Here are the screenshots. Please see the attached word doc.

    Loop Append To Documentlist Screenshots.docx (159 KB)


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


  • 5.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Fri October 25, 2019 05:15 PM

    Hi Franky,

    For appendToDocumentList, you must map a document to fromItem. You should be able to map /TestDetailOutput/Results within the loop as-is. I don’t see the need for DetailDoc.

    You must map a document list to the toList inputVariable and the output variable, toList, should be mapped to the same document list as was mapped to the input variable.

    However, I don’t know that appendToDocument is necessary at all if the new document is exactly the same as the output from DetailDoc.

    -Mary


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


  • 6.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Mon October 28, 2019 04:12 PM

    Hi Mary,

    Thank you so much for your help! I was able to append those records to documentlist, then map the documentlist to JDE BSSV.

    Now I have a different issue and see if you could provide some guidance.

    Here is what I want to achieve:

    For each detail record, I will always map the following:
    GL_AMT_AMOUNT_DOMESTIC => amountDomestic
    GL_AMT_BUSI_UNIT => businessUnit
    GL_AMT_OBJ_ACCT => objectAccount
    GL_AMT_SUBSIDIARY => subsidiary
    GL_AMT_NAME_EXPLANATION => nameExplanationRemark
    GL_AMT_REFERENCE => reference

    For each detail record, if the flag field has value, I will map the following:
    GL_VAT_GROSS_AMT => amountDomestic
    GL_VAT_BUSI_UNIT => businessUnit
    GL_VAT_OBJ_ACCT => objectAccount
    GL_VAT_SUBSIDIARY => subsidiary
    GL_AMT_NAME_EXPLANATION => nameExplanationRemark
    GL_AMT_REFERENCE => reference

    So the source fields are different but the target fields are the same.

    My idea is to use branch and check the flag field value = ‘Y’.
    If ‘Y’, I will append documentlist temp to documentlist temp2. I will append the new document Detail2 to
    documentlist temp2. If ‘N’, I will append documentlist temp to documentlist temp2.

    After the branch, I will append documentlist temp2 to documentlist temp3.
    Then I will map temp3 to my target documentReference, which is imported from JD Edwards Business Service.

    But my attempt is not working. Attached are the related screenshots.

    Loop Append To Documentlist Screenshots 000.docx (736 KB)


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


  • 7.  RE: Loop JDBC adapter results, try to append to documentlist, only the last record is appended repeated

    Posted Tue October 29, 2019 03:11 PM

    Hi Franky,

    If I understand correctly, your data source is TestDetailOutput/results and your data target is the JDE glDistribution (BSSV) doc list and you want to create one doc in BSSV if the HAS_VAT flag is “N” two docs if the HAS_VAT flag is “Y” with the difference being that the doc for “Y” will map GL_VAT_GROSS_AMT. Is that correct?

    There are other elements in BSSV that aren’t being mapped based on your screen shots. Will these be mapped or are they unused?

    Assuming that my assumptions above are correct, I suggest creating a document reference to the BSSV glDistribution (temporary) document to use for the append fromItem.

    Map to that document within each loop. For the append, fromItem will be your glDistribution document and toList will be the BSSV glDistribution doc list that is also your target output.

    Then branch on HAS_VAT flag and, if “Y”, map and append again just like above (except for the GL_VAT_GROSS_AMT mapping).

    So you’re mapping to the glDistribution temporary doc and appending to the BSSV glDistribution doc list in both instances. Except, if HAS_VAT flag = “N”, you’re only writing one doc to the BSSV target doc list and if “Y”, you’re writing two docs to the BSSV target doc list.

    -Mary


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