Looping over segments (doc lists)

I am running into an issue with looping over segments when mapping a documents list. I should say this is an intermittent issue, because I haven’t run into this problem before with similar conditions.

In particular, I am trying to map an 824 document to a canonical. I want to loop over the OTI segment an map the nested AMT from only the parent OTI qualified with a GA. The issue comes in, when the customer only sends a single OTI. WM doesn’t read this as a doc list, so my loop doesn’t work.

Without making duplicate mapping for a doc VS a doc list, is there some way I need to define my doc list so that it will be looked at as a list even if there is only 1 iteration. I am using the DT that WM provides in the schema.

Now, having made this statement, My REFs map perfectly in the 820 regardless if there is only 1.

Is OTI segment showing as doc list or doc in the 824 DT/schema?If it is doclist then even if single OT1 segment the EDIValues/ST/OT1 should show as list,Please make sure in the EDIFFSchema for 824 show this segment as list click on the segment and check if it shows maxRepeat=unlimited or 1…

HTH,
RMG

Yeah, rmg is right in recommending a check of the OTI field definition in the doc type. Sometimes there have been errors in the doc types/schemas.

Let’s assume, however, that the doc type is right. This would indicate that OTI is not allowed to repeat. Does the standard indicate that OTI is allowed to repeat? I haven’t worked with 824s before but the couple of implementation guides I looked at showed OTI with a max use of 1, though that may be an implementation specific constraint. It might be worth checking into before considering modifying the wM-supplied doc type.

I was just trying to look into the schema and it shows that the maximum usage is unlimited and also when i look into the document created using the schema,it shows as an document list. Typically if its a document list, inspite of a being a single document, it is displayed as document[0] within a list. The same loop should be working even if you receive a single document. If you are using the segment mapping, can you make sure you had supplied the OTI list from the EDIDOC to the input of the helper service which accepts OTI as an document list without any indices?

my OTI is a list and the only iteration is [0]

In monkeying with this a little, we have seen success in simply mapping the OTI list to an OTI doc list, and then looping over that new list. I dont like this solution, because it doubles the pipeline. But its working…

Ill pick this apart some more and post a solution.

Its weird…OT1 is a doclist by schema,but if you receive single OT1 it should still show as list,may be its a bug in the developer/schema parsing with convertToValues…See if there is any WM EDI fix for this 824 schema.

Anyways your temporary solution will keep moving forward,but as you said its doubles the steps in the pipeline…

HTH
RMG.

I don’t believe this is the case. Unless you’re doing something to duplicate the list and its contents, you simply have another variable reference to the array. You can check this by dumping a string output of “both” lists (may need to drop to Java), changing one of the entries in the list and then dumping the string output of both again. You should see that the change is reflected in “both” lists (since there is only one list with two references to this same list).

Rob you may be right…its worth while to test the above case…

I tested this for doc lists and string lists. Mapping a list to another list variable creates a reference to the same underlying list. It is not duplicated. Changes via either variable results in “both” lists showing the change.

This is consistent with the documentation that states only strings are copy by value. All other types are copy by reference.

I have just had the same problem in Developer. I fixed it by completing the “format as IS document” in the document within Trading Networks, which I had forgotten to do.