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

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!


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?


1 Like

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.


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)

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.


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)

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.