Maybe that’s my problem. I can drop the temp document, but fromItem and toList don’t appear in the pipeline out. I see the “appendToDocumentList” transformer, and I map the appropriate in and out values to the transformer fromItem and toList. But I can’t drop the service in/out values from the transformer itself. The “delete” option is grayed out whether I left or right click on those references.
What did I do wrong? Is that a clue? (THAT would be good - I need to get this working.) Thanks - MOD
oh ok if you are using as a transformer then you can ignore (dropping fromItem,toList)stuff,but drop that temp document in the pipelineIn itself instead of pipelineOut and once you drag map it to fromItem.
using appendToDocumentToList as a transformer also work as expected.
May be some other thing messing up in the pipeline which i am thinking,please check it thoroughly.
Not working for me. Like the docs say, as soon as I make a change to the fromItem in appendToDocumentList it’s reflected in the toList. All I’m doing is overwriting the reference each time. That’s why I end up with only one document in the list, and the value is the last one.
I really need to be able to clone the fromItem to make sure that it’s a new reference that’s added to the toList. How do I accomplish this? Is a Java service necessary?
Is your temp document/fields are having the same exact names as in the original Document 19(toList),then only append temp document to original doclist will work as expected,its a trick.this will internally reference and reflected to toList.
And you dont need to write any javaservice for accomplising this.
Hello,
One thing, when you want to drop an input that is going into a transformer, first close the transformer. I don’t think your first two temp entries need to be outside the loop. It should be your last list “19”. I am not going to look at your code because it will only confuse me (not your fault, I interpret words better than code). So …
[L.N] = LOOP AT LEVEL N
-> ARROWS POINT OUT ASSIGNMENT
| PIPE SEPERATE INPUT SIDE FROM OUTPUT SIDE
DOCUMENTLIST A <- SET EMPTY
DOCUMENTLIST N9/MSG
[L.1] INPUT N9
[L.2] INPUT N9/MSG
[MAP] {APPENDTODOCUMENTLIST} TOLIST A, FROMITEM MSG | TOLIST A
That should be all you need. If you want to have a clone of the source lists, then …
DOCUMENTLIST A <- SET EMPTY
DOCUMENTLIST N9/MSG
[L.1] INPUT N9
-DOCUMENTLIST TEMP1 <- ASSIGN EACH NEEDED FIELD WITH BLANK ENTRY
-[L.2] INPUT N9/MSG
–[MAP] MSG FIELD | TEMP1 FIELD
-[L.2]
[MAP] {APPENDTODOCUMENTLIST} TOLIST A, FROMITEM TEMP1 <- DROP | TOLIST A
[L.1]
The temp19 has the exact same field name as the Document in the output List.
Just stepped through in the debugger. I can see the first line of the order line text mapped into temp19. Then the output List has 19[0] added to it with the correct value.
On the next iteration through the loop I can see the next line of order line text mapped into temp19. But when I check the appendToDocumentList step, the output List still has only 19[0] instead of 19[0] and 19[1]. The value of 19[0] now matches the second line of order line text, not the first one.
The end result is that the document has only one line of order line text mapped instead of eight, and the value of that single line is the last one that was read in for that line item detail.
What did I miss with pub.list:appendToDocumentList? I’m running v6.0. Thanks - MOD
Hello,
One thing, when you want to drop an input that is going into a transformer, first close the transformer. I don’t think your first two temp entries need to be outside the loop. It should be your last list “19”. I am not going to look at your code because it will only confuse me (not your fault, I interpret words better than code). So …
[L.N] = LOOP AT LEVEL N
-> ARROWS POINT OUT ASSIGNMENT
| PIPE SEPERATE INPUT SIDE FROM OUTPUT SIDE
DOCUMENTLIST A <- SET EMPTY
DOCUMENTLIST N9/MSG
[L.1] INPUT N9
-[L.2] INPUT N9/MSG
–[MAP] {APPENDTODOCUMENTLIST} TOLIST A, FROMITEM MSG | TOLIST A
-[L.2]
[L.1]
That should be all you need. If you want to have a clone of the source lists, then …
DOCUMENTLIST A <- SET EMPTY
DOCUMENTLIST N9/MSG
[L.1] INPUT N9
-DOCUMENTLIST TEMP1 <- ASSIGN EACH NEEDED FIELD WITH BLANK
-[L.2] INPUT N9/MSG
–[MAP] MSG FIELD | TEMP1 FIELD
-[L.2]
[MAP] {APPENDTODOCUMENTLIST} TOLIST A, FROMITEM TEMP1 <- DROP | TOLIST A
Please make sure that you drop the temp document which you mapped to transformer input fromItem(when dropping just close the transformer click - and then drop the temp document in the pipelineIn at that point itself.This will allow not to overwrite the existing iteration in the toList.
It is very simple and you should have tried this way which i have mentioned in the last few posts.
this is not so complex logic,believe me appendToDocumentList is my favourite…
Michael,
The way suggested by RMG is perfect and it works very fine with me. In fact i have been working with appendToDocumentList since i started using webMethods. It works very fine but the thing is you need to explicitly drop the fromItem,toList and your Temp Document in the same map step or add a map step just to drop them. And If there are null elements on the output side please check also your field names. If the field names contain some special characters you will get a null value in the output. (I know this doesn’t fit to your situation but i have faced this, so thought of sharing my experience)
P.S : Thanks RMG and Rob for excellent stuff you have provided in your previous posts
Thanks so much for your postings. I realize that I’m being a helpless noob here. So many people have stood up for appendToDocumentList that I’m sure it works, and that I’m just doing something stupid to gum up the works. Perhaps with your help I’ll figure out what that is today.
It’s still not working for me. I had a thought last night on the way home: perhaps I was creating the temp19 Document in the wrong place. I thought I needed a new one every iteration through the loop (the equivalent of calling a Java “new” for each Document). That way I’d have a new reference for each MSG that I wanted to append to the list.
I moved it inside the loop over all MSG Documents this morning, like this:
LOOP over all /N9
LOOP over all /N9/MSG
MAP to create a new temp19 and set value to null
MAP to map MSG order line text to temp19/ORDER_LINE_TEXT
MAP to append temp19 to DocumentList using appendToDocumentList
I drop temp19 at that third map step, but I can’t see any way to drop fromItem or toList from the transformation. Perhaps that’s what I’m missing.
When I run this through the debugger I can see a new temp19 created, appended to the DocumentList, and dropped. But each time I iterate through the inner loop the current value of temp19 overwrites the previous one, so I’m left with a DocumentList with element [0] whose data is the last order line text that was read.
I apologize for being so thick. What have I missed? If dropping the fromItem and toList is the key, should I be seeing those in the pipeline output? Do I need to add a separate step to clean up that pipeline? Thanks - MOD
Rama has sorted me out. The key step that I missed was mapping the DocumentList from the pipeline in to the “toList” in the pub.list:appendToDocumentList service in. Once Rama pointed that out to me, all was well.
Here’s the final pipeline sequence that I ended up with:
MAP to create a temp19 Document and initialize it to null
LOOP over all N9 (no output array)
+ LOOP over all N9/MSG children (no output array)
++ Map value from MSG to temp19
++ Map pipeline in temp19 to “fromItem”, destination DocumentList to “toList”, and “toList” to pipeline out destination DocumentList in pub.list:appendToDocumentList transformer service; drop temp19 from pipeline in.
This sorted me out perfectly.
To anyone who posted this solution, I apologize for my inability to see and understand.
To Rama, thanks again for your expertise and patience. I couldn’t have done it without you.
Thanks to all who participate on this forum. It is an invaluable service. I hope I can raise my level of expertise enough to give back someday. Sincerely, MOD
I am mapping a ANSI X12 850 document reference with an SAP IDOC Document Reference.
Here I have an document list whose values have to be hard coded 4 times.
So,I have taken a loop and entered the string values once.
Indented another loop below the previous loop and again entered the values.
But here I need not map the 850 input with SAP IDOC as output.
Now,I need to give the input array.What shall I give it as?
Hi RMG and Michael,
I have another fundamental question : when using loop step, we have input array and output array. there is a scenario that mapping from one document list to another document. i read somewhere (not able to recollect where) that using document list name in output array is not recomended because it some times gives weird results. rather than using document list name in output array, use append to document list.
Could you please suggest the best way to perform this, also correct me if i am wrong.
You can use either way,depends on both source target documentList (loops) and map it one to one OR use appendToDocumentList approach loop on source list and map to document and finally appendToDocumentList (target)
Depends on the easier approach/complexity involved i will go append approach.
Thanks for your reply RMG,
I just want to know, is there any special reason why u choose append to doc list (asking out of curiousity :))
did you come across any issues or challenges while using the document list name in output array of loop. if so pls let me know.
Yes,but i can’t recollect whats the exact issue was that time(probably handling deeper/recursive loops for example:RNO,OAG documents).If it is one to one mapping i some times depended on InArray/OutArray iterations and it works.