webMethods

webMethods

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

Null elements in output array when mapping EDI to output FF schema

webMethods Community Member

webMethods Community MemberWed November 10, 2004 05:44 PM

  • 1.  Null elements in output array when mapping EDI to output FF schema

    Posted Fri October 15, 2004 09:33 PM

    I’m trying to make wM handle my company’s 850, 860, and 820 EDI transactions using wM. Here’s my wM version info:

    Version 6.0.1
    Updates IS_6-0-1_SP2
    TNS_6-0-1_Fix20

    Build Number 425

    The server is running on a Unix platform.

    I’m having a fundamental problem while mapping the EDI 850 to another internal flat file schema. I do the usual thing: map the 850 header, loop over each line item detail /T850DT/ST/P01, and then map the summary. The internal flat file schema is VERY flat: the output array is /InternalFF/11.

    In my mapping service I have a LOOP where the input array is /T850DT/ST/PO1 and the output array is /InternalFF/11. Under that I invoke a service called MapLineItemDetail that takes a document type PO1 as input and 11 output.

    I’m sending in an EDI 850 document that has 3 PO1 children. When I run my service I get back my InternalFF with an array of 3 “11” documents, as it should, but all three are null.

    When I step through the debugger, I can see that the LOOP is executed three times. The proper data for each PO1 element is visible in the Results tab, so I believe the input data is arriving as it should.

    What did I miss in the mapping step, and why are the values null? I map four String values from the PO1 to the 11 document, so those are mapped by value. How can the output 11 document be null? How to best debug this? Please advise. Thanks - MOD


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 2.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Fri October 15, 2004 10:15 PM

    Michael,

    As a debug purpose what you do is before LOOP step just initialize this document InternalFF/11(Add a map step and do a setValue(empty) and use Test/Step thru the loop and inside the loop just disable the MapLineItemDetails service istead add a map step and map the individual fields to 11 document,so for testing purpose step each iteration of the PO1 and check the results whether data is extracted in the FF/11 document.Once you confirm then enable the MapLineItemDetails and test the same for each PO1 iteration.

    This should work after debugging the problem.

    HTH,
    RMG.


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 3.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 04:18 PM

    Hi RMG,

    I got past this problem by creating a MapAllLineItemDetails service that takes a PO1 document list as input and an 11 document list as output. This service simply LOOPs over the respective arrays and calls a MapLineItemDetail service that maps an individual PO1 document into an 11 document. When I use this trick I see the data moved into the output document as it should.

    Now underneath each PO1 document I have a CTP document list that represents pricing information for this line item detail. This should map into a document list of type 12 in the output document. When I try to repeat this trick, by creating MapAllPricingInfo and MapPricingInfo services for pricing information, it fails me. I don’t see the /12 document list created under the /11 parent.

    In the LOOP over pricing information, I have /CTP as the input array and /12 as the output array. There’s no mention of the /PO1 and /11 parents at this point.

    I thought I’d corrected it on Friday, but that’s not the case this morning.

    I think I have a fundamental misunderstanding of the operation of the pipeline. If anyone can spot the flaw in my logic I’d greatly appreciate it.

    %


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 4.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 04:52 PM

    Michael,

    There is a work around for this parent/child mapping stuff and for this you may have to use different logic.

    What you have to do is create a temporary /11 {arent documentReference which has /12 document is child(11/12).

    So loop over PO1 and map the line data to 11parent document and under the same loop keep another loop PO1/CTP and map the pricing data to 12document and finally use the appendToDocumentList service(inputs map the temporary11 document to fromItem and map the original 11 documentlist to toList and output toList to origina /11documentlist and make sure you drop the fromItem(temporarydocument)at that point itself so that data is not overwritten and come of the loop and check the results.

    So now this will have data the 11/12 documentlists using from PO1/CTP.

    Sorry if my comments are confusing.

    HTH,
    RMG.


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 5.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 07:19 PM

    Hi RMG,

    Thanks again for your attention and patience.

    Should the top-level source and target documents remain in the pipeline all the way down when mapping deeply nested documents like this?

    This is a fundamental criticism I have about the webMethods documentation. There’s plenty of it, but I’ve found few examples, and these are usually of a trivial nature. There’s no “patterns” or “common idioms” or “how to” or “hello world” that I’ve found to lay out how these things should be addressed.

    Perhaps I’m just a slow, dull user, but I’ve read a great deal of the hundreds of pages of documentation and I’ve found it hard to pull together into a coherent approach.

    Thanks for the venting opportunity.

    %


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 6.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 08:00 PM

    Here’s a fundamental question:

    “reference” is such a loaded term to a Java developer.

    When should I choose a Document as my input/output type, and when should I prefer a Document Reference? What is the difference between the two, according to webMethods?

    Thanks - %


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 08:05 PM

    ANOTHER fundamental question:

    It seems to me that anytime I change input/output for a service I have to start again with defining the underlying pipeline. I have to delete everything that’s underneath and start all over. It’s as if the choice of input/output is so key that nothing else can go forward until that’s complete, and getting it wrong means losing all you’ve done. Does that agree with your experience?

    %


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 8.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 09:39 PM

    Michael,

    Its always better to use DocumentReference so that this will give flexibility when adding any new fields in the documentStructure at one place and this change will effect in all the mapping services/maps where ever you used this document as a documentReference.This is like a Canonical document(generic structure).

    If you just use service input/output then the document is dedicated to that service use only.

    Since you are involved in EDI project mapping EDI document to FF,so start using the documentReference like example doc_850(X12_4060_850),if you create a temporary documents then you can make choice of using documentReference or just create a document/fields stimulating like original document.

    HTH,
    RMG.


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 9.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 09:50 PM

    Hi RMG,

    Thanks again for looking in.

    I appreciate the advice to always prefer DocumentReference to Document. Can you provide that last bit about the real difference between the two?

    Thinking as a C++ developer (since Java is ALWAYS pass by value), it feels like the difference between “pass by reference” (DocumentReference) and “pass by value” (Document). I can change the values in a DocumentReference, but not a Document. Is that accurate?

    (Java, of course, is always “pass by value”, but the thing that’s passed is a reference to the object itself. Objects aren’t passed, but their references are. You can take the reference and modify the object it points to, but not the reference itself.)

    “If you just use service input/output then the document is dedicated to that service use only.” - so if I write services that deal only with the child Documents/DocumentLists, I need to write an additional step to map their output back into the parent document (e.g., your “appendToDocumentList” transformation). Correct?

    Right, I am using the T850DT that’s supplied. The examples appear to have only one level deep nesting. The real thing has more than that. Hence my problem.

    Thanks again - %


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 10.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 10:03 PM

    Michael,

    If you just use service input/output then the document is dedicated to that service use only." - so if I write services that deal only with the child Documents/DocumentLists, I need to write an additional step to map their output back into the parent document (e.g., your “appendToDocumentList” transformation). Correct?

    –yes this assumption is correct.

    And if you change the document Field(names)in the serviceI/P,O/P and as well documentReference then the workaround for this is you have to remap already existing maps which is hectic,some times this happens if functional stuff changes or due to communication gap in the integrations.

    Regarding values you can change these in runtime(pipeline)

    HTH,
    RMG


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 11.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 10:27 PM

    Hi RMG,

    Thanks again for hanging in there with me.

    “–yes this assumption is correct” - this is where I get confused. If I study the Tutorial.EDItoXML under WmEDIsamples I don’t see anyplace where the appendToDocumentList is used.

    I’m not changing any names at any time. When I specify input/output Document, I cut & paste right out of the doc. That way I get the parent and all its children.

    I thought I understood this last Friday afternoon, but I’ve wasted an entire day going in circles and making no progress. It’s been a frustrating day.

    %


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 12.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 10:30 PM

    In trying to clean up my pipeline, I just tried dropping one of those intermediate input documents. It had an immediate negative impact on the output document - the array of line item details were all null as soon as I dropped the PO1 doc.

    I’m still not understanding how your pipeline works. I’ve re-read the Developer Users Guide again, but I’m obviously not seeing it. Sorry.

    %


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 13.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 10:44 PM

    I just ran one of my test input EDI 850 X12 V4010 that I received from our client in the Tutorial.EDItoXML:processEDI850_4010 service. I cut & pasted the raw EDI text into the input String using the “larger editor”.

    I got an error message back: “Actual document count (1) doesn’t match GE01 (2)”

    There’s only one GS in my input stream, so I edited the input so the first value following GE was 1. I got a correct looking XML stream back.

    At least I know the sample works.

    Does this error indicate that there’s something “wrong” with my input? This is data that I got directly from our client that’s been processed.

    %


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 14.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon October 18, 2004 11:20 PM

    Micheal,

    This service Tutorial.EDItoXML:processEDI850_4010 behaved correctly by throwing the error(Actually this is a warning message nice catch up isnt it?).

    The raw edi text input string you got from the partner might have the only one GS segment but in the GE01 field count showing as (2),they must have copied only one GS segment data and send it to you and missed to update GE01 count(1).Anyways you have solved the problem by editing.

    Regarding appendToDocumentList service the WmEDISamples services might not have used this at all.Its all depends on handling the logic in different easier ways,so WM provided us these utility buitin services keeping in mind for example that you are facing now with parent/child doclists creation(recursive structures).

    When I specify input/output Document, I cut & paste right out of the doc. That way I get the parent and all its children.

    —For avoiding this kind of manaul problems use the documentReference,so this will be used in the pipeline and you can map the elements directly instead of cut & Paste out of the doc.

    Forgive me if i am not able to answer your questions as expected.just sharing my experiences as much as i can.

    HTH,
    RMG


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 15.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 02:06 AM

    Michael,
    Just a thought. But when you’re mapping in the loop make sure you create the LOOP first and then link the elements inside the loop.
    If you link the elements first when the definition is still a list and then push them under LOOP, they will look correct in Developer and when you step thru they will get executed but you will get a Null result.
    Try unmapping the elements, save the service and then re map them under loop.


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 16.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 02:20 PM

    Hi Chris,

    I’m doing exactly as you’re suggesting: I create the LOOP and then add a service that’s invoked underneath it that does the work. The input for the service is the Document type of the input array, and the output is the Document type of the output array (note: NOT DocumentReference).

    Thanks - %


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 17.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 02:27 PM

    Hi RMG,

    The exception that I got from the EDI sample troubles me. I agree that it makes perfect sense, based on the design of the EDI schema in wM.

    But this is one of the EDI docs that I’ve already received from our supplier. If this is the way THEY send me documents, then I’ll have exceptions every day when I use wM to process them until I can persuade them to change what they send in their EDI transmissions.

    It also makes me wonder about the s’ware we’re using to process EDI today. If the given input violates the EDI spec, then why have we been processing them successfully all these years?

    Troubling. I can’t get this project off the ground, and now I worry that when I do it’ll fail because the data I’m sent doesn’t conform to the EDI 850 schema in wM. Oh, my.

    It’s all a moot point until I figure out/solve my looping problem.

    %


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 18.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 02:33 PM

    Hi all,

    If the appendToDocumentList idiom is required, why doesn’t the EDI tutorial use it?

    It feels like I’m missing something very fundamental, because this shouldn’t be this difficult. Mapping from one schema to another is bedrock to webMethods. There are visual icons to make this as intuitive and easy as possible. (Far more intuitive and easy than writing XSL stylesheets by hand.)

    That makes it even more frustrating for me: I’ve got to be an eejit for missing it so badly. :wink:

    I’ve had an easier time writing XSL stylesheets to transform from one schema to another. There’s something wrong with me. Can anyone see it? I’ve gotta get this project up and running, and soon.

    I hope there are wM support folks lurking on this forum.

    %


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 19.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 02:56 PM

    Michael,

    Somewhere along the many post here I’ve lost exactly where you’re stuck right now.
    Can you briefly summarize your problem?


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 20.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 03:10 PM

    Michael,

    Please make sure from your parter that raw EDI string they sent is real data or not.And also point them regarding GE01 count is wrong when there is only one GS segment.as i said there might be some manual editing involved when they copied the data and missed to update GE01 count.

    appendToDocumentList is not a must in the EDI mapping,but due to your target document structure this service makes easier to build the FF structure as expected.I am not sure why you are not comfortable about using this service.

    you are right mapping is much easier in WM no doubt about it,even when it is complex case.So using of buit-in services,custom java services helps to move further.

    If you are comfortable understanding the provided WmEDISamples,please proceed with that.

    We wmusers will help you further,

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 21.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 04:05 PM

    Hi Chris,

    I’ve trying to map an EDI 850 to another flat file schema. I’m using the wM document EDIFFSchema.X12.V4010:T850DT in the WmEDIforTN package as my input document reference. The output type is based on a custom flat file schema that I’ve created. I’ve sent instances of this flat file document through the service for parsing, and they’ve all worked. I believe that’s okay.

    So far, so good.

    As you’d expect, both the EDI input and FF output docs follow the same general format: a header, followed by one or more line item details, with a summary bringing up the rear.

    When I send an EDI input through and look at the FF output I get, I can see the header, the correct number of line items, and the summary. However, the details underneath the line items in the FF output are lost. There are lists of documents under the line item details (e.g., multiple pricing info docs that should map from the CTP EDI records and order line text that should map from the MSG EDI records) that aren’t mapped into the output doc properly. These are nested loops that I’m still not doing properly. This is where my poor understanding of the pipeline and LOOPing shows up.

    %


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 22.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 04:12 PM

    Hi RMG,

    I agree - I will have to speak to our trading partner about the EDI we’re receiving. I’m looking at text files that supposedly represent the “raw EDI”, but I’m not 100% sure that when I configure wM to poll the VAN mailbox to pull out documents on a daily basis that this is what it’ll receive. I’ve got to check that out.

    “appendToDocumentList is not a must in the EDI mapping,but due to your target document structure this service makes easier to build the FF structure as expected.I am not sure why you are not comfortable about using this service.”

    It’s not a matter of being uncomfortable with using the service, although I will admit that I’m still feeling my way around the API. I’m just saying that if this was such an important technique that I would have expected to see it in the docs and the examples. I’m not sure I understand why my target schema requires it. It’s just another flat file schema that happens to have several loops nested under the line item details loop. That’s different from the examples, which only show one level of LOOPing, but it’s not terribly complex IMO.

    “If you are comfortable understanding the provided WmEDISamples,please proceed with that.” - I’m still not comfortable with anything, but I’m going to keep plugging.

    “We wmusers will help you further” - I don’t mean to sound ungrateful or to denigrate the response of wM users.

    I’m just used to the Java forum over at Sun. I think the pool of participants is bigger there than it is here, that’s all.

    Thanks again to all who have taken the time to reply. Sincerely, MOD


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 23.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 04:32 PM

    Micheal,

    As a first step in the mapping use FF as a documentReference or just output document and initialize this structure using setValue null,so this document will be carried out in the pipeline.

    Inside the PO1 loop,keep another loop PO1/CTP as the input array
    and /11/12 as the output array and map the pricing information to target /12 documentlist and similarly for MSG keep another loop under PO1 inarray is PO1/MSG and map to target FF structure.

    Are you using this way?

    If the above scenario not working, alternate option is using of appendToDocumentlist as said above.

    HTH,
    RMG.


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 24.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 19, 2004 07:17 PM

    Loops can be a killer in wm.
    IF your document looks like this
    hrdRec …
    —>DetList
    -----Det1istSub1
    --------Det1istSub2
    ---------->DetRec
    SumRec

    The flow service will need to do the following to access the DetListSub?:
    LOOP on DetList (where DetList is a List)
    –>LOOP on Det1ist/Det1istSub1
    (where DetList is now a record and DetListSub1 is a List)
    -----> LOOP on Det1ist/Det1istSub1/DetListSub2
    (where DetList & DetListSub1 are records and DetListSub2 is a List)
    Now you can map DetListSub2 and DetRec

    When you look at the inputs for your loops are you seeing DetListSub1 or are you seeing DetListSub1[0]?

    The key to getting this right is you have to use a step approach. By this I mean map the outter LOOP on DetList and drop only a map step within the LOOP. From there, open the record of DetList and copy DetList/DetListSub1 list and past that into the next LOOP instruction.
    Repeat this for each nested LOOP.
    At this poine when you look at the empty map statement within the LOOPs you should be able to see list correctly represented as a record. Then you should be able to map. You MUST have a record representation and not a recordList when you actually map. Mapping directly from the recordList can cause unpredicatable results in some cases. Best to stay away from it.

    Where you will need to use appendToDocumentList is where you have a one-to-many or man-to-one mapping. For instance the input is a list but your app file stores this info in a record that does not repeat.

    Let me know if I’m on the right track and if this helps.
    Sorry for the long winded reply.


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 25.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed October 20, 2004 04:42 PM

    Hi Chris,

    “Loops can be a killer in wm”

    Thanks for this. I feel like an eejit for having so much trouble with this.

    Okay, I’ve learned one difference between Documents and Document References that’s key: You can only create a reference to a Document that’s defined in your packages. So I can have a reference to the T850DT root document type, and I can have Document and Document List inputs that are PO1 and CTP children of the T850DT/ST root, but I CANNOT have references to PO1 or CTP because neither of those are defined in my packages. I lose all the underlying child info. THAT’S a big difference. (Sorry for being so slow.)

    Here’s what I see happening in my debugger when I step through. I have five services involved, and I can see exactly where I go wrong. (I just don’t know what to do about it yet.)

    1. Map850ToTrustedLinkRequest
      service input = T850DT reference
      service output = TrustedLinkPORequest

    This is the top level service that has a MAP step for the header, a service named MapAll850LineItemDetails, and another MAP step for the summary. If I click on the “MapAll850LineItemDetails” service in this flow, I see that the pipeline input maps its PO1 document list to the service input; ditto for the output “11” document list. When I step through the debugger, I can see all the header info in the output TrustedLinkPORequest and the complete contents of the T850DT input doc in the Results tab.

    1. MapAll850LineItemDetails
      service input = PO1 Document List
      service output = 11 Document List (Yes, that’s “11” as in “eleven”. Crazy schema.)

    This service has a LOOP at the top that has /PO1 as the input array and /11 as the output array. The body of the loop contains a single INVOKE step: Map850LineItemDetail(Note: no mention of parent in arrays.) When I look at the pipeline I see that I’m mapping the PO1 list Document (NOT a reference) from the T850DT into the service input PO1 list; same with the output. When I step into this INVOKE in the debugger I can see a PO1 Document List with 3 child documents underneath, plus the complete T850DT and partial TrustedLinkPORequest.

    1. Map850LineItemDetail
      service input = PO1 Document
      service output = 11 Document

    This service contains a MAP step for the line item info, an INVOKE step called MapAll850PricingInfo, and another MAP for tax exempt info. When I look at the pipeline I see that I’m mapping the CTP list child from the PO1 into the service input PO1 list; same with the output. When I step in using the debugger I see the first PO1 Document. It has a Document List of CTP children of length one.

    1. MapAll850PricingInfo
      service input = CTP Document List (NOT a Document Reference List)
      service output = 12 Document List (“twelve”; NOT a Document Reference List)

    This service has a LOOP at the top that has /CTP as the input array and /12 as the output array. (Note: no mention of the PO1 or 11 parents.) When I step into this service and look at the Results tag, I see the CTP Document List with a single CTP Document child underneath, along with some other documents. When I enter the LOOP, I see the first CTP Document on the Results tab.

    1. Map850PricingInfo
      service input = CTP Document
      service output = 12 Document (“twelve” Document)

    This service has a single MAP step that copies values from the CTP Document into the 12 Document. On the Results tab I can see the first CTP document and its values, so I believe that information is getting down to the service. When I exit this service, I can see the 12 Document populated with the proper values. This appears to be the point at which I lose the 12 data It&#3


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 26.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed October 20, 2004 05:03 PM

    Michael,

    Please follow my last post in this thread and also modify in your MapAll850PricingInfo
    service input = CTP (SegmentDocument)
    service output = 12 Document List (“twelve”; NOT a Document Reference List)

    and so when you loop over the PO1/CTP then map the CTP(document) to the above service input and the service just add a map step and map the CTP information to a temporary 12/document and use the appendToDocumentList to build /12 documentlist and exit out of the PO1/CTP loop and map the 12 document list to parent 11/12 documentlist.

    This way you can eliminate the Map850PricingInfo service since you already mapped the individual elements in the map step of MapAll850PricingInfo service.

    HTH,
    RMG.


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 27.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed October 20, 2004 07:10 PM

    Hi RMG,

    Sorry for being so slow. I’ve printed both your responses. I’ll be studying both carefully this afternoon and trying them out. Thanks - MOD


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 28.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu October 21, 2004 04:04 PM

    Hi RMG, Chris, and all wM forum members,

    Thanks to your patience, and some dogged thinking, I’ve finally seen where I went wrong.

    I couldn’t understand why the output Document Lists that I was mapping were getting lost in the pipeline. The key was to make a Document List pipeline output with the same name as the service output Document List and then drag & drop it up to the parent document to make it a child. Map the service output Document List to this new child Document List, drop the service output Document List from the pipeline, and everything is perfect.

    Looping in my case turns out to be relatively easy, in spite of all the difficulties I’ve had. The input document array generates one output array entry for each iteration through the loop, so I can use the LOOP /input and /output array notation to good advantage. No need for appending documents to list or anything else.

    I’ve done this trick several times since I discovered it. My EDI-to-FF mapping is progressing nicely now.

    Thanks to all of you for your patience and insight. I hope this thread will help someone else who’s facing wM LOOPing for the first time in the future. - %


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 29.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu October 21, 2004 04:13 PM

    Michael,

    Glad you finally got make it working…Hooray!!!

    Ofcourse in some cases input/outpurt array notation works,but for me append to document list makes easier in complex cases.

    bottomline is loops should be handled carefully.

    Goodluck,


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 30.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu October 21, 2004 04:45 PM

    Hi RMG,

    Thanks again for checking in on me all this time.

    Right, I think your appendDocumentToList idiom is required for cases more complex than mine. I’ll have to keep it in mind for future work.

    I appreciate those folks who help out noobs like me on this forum. It’s a great service, and you can’t beat the price. Thanks again - %


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 31.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu October 21, 2004 08:40 PM

    Michael,
    Your solution is ok. I will append to RMG. You will note that if your inner steps of the loop don’t have data to write to the output list, you will have a “null” in its place. RMG’s suggestion would eliminate this for you when you don’t need elements for exist with array position preserved.
    Be careful with tricks and short cuts, I too know that putting “input/output” tab variable will allow it to show on loops with the output having the same name. I too would suggest that you make an explicit MAP step before the loop with the variable and just click the blue “set inputs” arrow and leave it blank.
    Best practice that you will find over time is this approach for a consolidated list and it only requires one map step before and inside the loop.


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 32.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu October 21, 2004 11:51 PM

    Yemi,

    I agree with your setValue null the output(document/list) option in a map step before the loop especially when using InArray/OutArray logic.

    Regards,


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 33.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Fri October 22, 2004 09:45 PM

    Thought these threads on looping may be of some help:

    [url=“wmusers.com”]wmusers.com
    [url=“wmusers.com”]wmusers.com


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 34.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue October 26, 2004 03:44 PM

    Hi Rob,

    Brilliant stuff. The explanations I’ve read from you have been so clear and concise. You’ve added to my meager understanding of webMethods by leaps and bounds. Thanks so much. Sincerely, MOD


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 35.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed October 27, 2004 06:45 AM

    Kind of you to say! Glad to be of assistance.


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 36.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 07:59 PM

    Hello all, especially Rob Eamon. I hope you’re still watching…

    I thought I had this knocked, but I’ve still got a subtle problem.

    I’ve read Rob’s excellent thoughts and tried to make them my own, but it’s still not working out. I’ve got to be missing something, so I’m back at the forum with my hat in my hand.

    I’ve had a doubly-nested loop working out just fine, using both input and output arrays. However, I have a pathological test case that “loses” one line of order message text.

    So I ditched the output array approach and tried Rob’s advice. Here’s my flow:

    Input document has DocumentList N9 with child DocumentList MSG
    Output document has DocumentList 19
    + Outer loop over all /N9 elements; no output array
    ++ Inner loop over all /N9/MSG elements; no output array
    +++ MAP create a temp 19 Document and initialize it to null
    +++ MAP the String value out of the N9 Document into temp 19
    +++ MAP temp 19 appendToDocumentList to output Document 19 list;
    +++ Drop the temp 19 Document from the pipeline

    When I loop through in the debugger I see the “dropped” order message text created and appended to the output Document list.

    But subsequent iterations through the loop overwrite each other. I end up with a Document list containing the last instance instead of the 8 that I expect.

    If I read the built-in service docs I see this:

    “The documents contained in fromList and fromItem are not actually appended as entries to toList. Instead, references to the documents in fromList and fromItem are appended as entries to toList. Consequently, any changes made to the documents in fromList and fromItem affect the resulting toList”

    Must I resort to a Java server and com.wm.data.IDataUtil.deepClone to append to the list, or did I miss something again?

    I can get seven of the eight Documents I expect in the list if I use output array semantics in my Loop. I’m still chasing that one lost Document.

    Thanks for your help and patience. Sincerely, MOD


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 37.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 08:16 PM

    Michael,

    Please try to do this way.

    Actually move the initialize step outside of the loops as shown below

    +++ MAP create a temp 19 Document and initialize it to null

    Outer loop over all /N9 elements; no output array
    ++ Inner loop over all /N9/MSG elements; no output array
    +++ MAP the String value out of the N9 Document into temp 19
    +++ MAP temp 19 appendToDocumentList to output Document 19 list;(In this map step itself drop the temp19,fromItem,toList

    and finally step thru the each N9/MSG loop iteration,you should see the append stuff and come out of the loop see the result as expected.

    Note:No need to map froList just use appendToDocumentList Service Input fromItem (temp19),toList(original Document 19) and Service Output toList(Original Document 19).

    May be you are looking for Ray for better explanation,i tried my best to respond.

    HTH,
    RMG.


    #webMethods
    #Integration-Server-and-ESB
    #edi


  • 38.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 08:54 PM

    Hi RMG,

    No, your explanation is fine. No insult intended. :wink:

    I think I implemented what you suggested, but I’m still not getting the entire list. Only the last line of order message text appears in the list.

    The reference semantics seem to be the problem.

    What did I miss? I’ve attached a ZIP with the HTML representation in case that’ll help. Thanks - MOD


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 39.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 08:56 PM

    I should point out that level 2.8 is the MAP step at the start of the loop in question. It continues down to level 2.94. Thanks - MOD


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 40.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 09:11 PM

    Michael,

    I have downloaded your HTML file but is not working (no images etc…)it is just showing the segment names.

    my solution for appendToDocumentList should work (but critical part here is dropping fromItem,temp document,toList in the pipelineout.

    HTH,
    RMG.


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 41.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 09:32 PM

    Hi RMG,

    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


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 42.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 09:43 PM

    Michael,

    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.

    Regards,


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 43.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 10:17 PM

    Hi RMG,

    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?

    %


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 44.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 10:34 PM

    Michael,

    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.

    HTH,
    RMG


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 45.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 10:42 PM

    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]

    Good day.


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 46.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 10:44 PM

    Hi RMG,

    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


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 47.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 10:47 PM

    MODIFIED

    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

    [L.1]


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 48.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 11:03 PM

    Michael,

    Thanks for clarification and attempting as said.

    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…

    HTH,
    RMG>


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 49.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Tue November 09, 2004 11:09 PM

    Michael,

    Please check your yahoo mail.i just sent it.


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 50.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed November 10, 2004 05:13 AM

    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

    Regards,
    Pradeep.


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 51.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed November 10, 2004 03:11 PM

    Hello all,

    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


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 52.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed November 10, 2004 05:08 PM

    Hello, forum members:

    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


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 53.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Wed November 10, 2004 05:44 PM

    Glad to help,

    Regards,
    RMG.


    #Integration-Server-and-ESB
    #webMethods
    #edi


  • 54.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Mon December 12, 2005 08:35 AM

    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?

    I gave output array is SAP_IDOC …

    Please suggest me?


    #Integration-Server-and-ESB
    #edi
    #webMethods


  • 55.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu September 17, 2009 04:35 PM

    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.

    Thanks,
    Bala


    #edi
    #Integration-Server-and-ESB
    #webMethods


  • 56.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu September 17, 2009 08:27 PM

    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.

    HTH,
    RMG


    #webMethods
    #edi
    #Integration-Server-and-ESB


  • 57.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu September 17, 2009 08:57 PM

    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.


    #edi
    #webMethods
    #Integration-Server-and-ESB


  • 58.  RE: Null elements in output array when mapping EDI to output FF schema

    Posted Thu September 17, 2009 09:15 PM

    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.

    HTH,
    RMg


    #Integration-Server-and-ESB
    #edi
    #webMethods