Hi folks, I’ve been using WM developer 6.5 for a couple of years now and am reasonably comfortable with the basic use etc. We have recently upgraded to v 8.1 and I am having some issues with the looping.
My document may contain multiple invoices and of course each invoice can have multiple lines.
in my nodeToDoc step I have make arrays set to “true” and I have Invoice and InvoiceLine as entries in the arrays.
when I loop over Invoices and InvoiceLines the map steps in correctly but what i find is that in each section where in 6.5 it would show Invoice and Invoice line to be a single document, in 8.1 it shows it as an array of documents like I haven’t run it through a loop.
when I loop through the InvoiceLines, I cannot pull data from that segment and if I look at the indexes it will allow me to enter the array counter where usually when you are looping through it wouldn’t allow that.
Basically it is acting like it ignores the loops even though it loops through correctly.
In the first loop (the invoice loop) I can pull data but in the second loop (invoice lines) I cannot pull data.
this service is actually pretty simple and right now there are only the two loops, one for the invoices and one for the lines. Of course the loop for the lines is a child of the loop over the invoices.
Can you share the “LOOP over” details?
you have a loop and the input array is …/…/Invoice and …/…/Invoice/InvoiceLine.
I do not specify an output array.
I would suggest to not use makeArrays. Instead, define a document type and specify that in nodeToDoc and map the output to a var that is reference to the doc type.
I have a document type but we found in 6.5 that in many cases if you didn’t set make arrays = true and define the arrays that it wouldn’t loop properly.
I just used the same logic in 8.1 when I had issues.
I was able to figure out how to get around the issue.
My business scenario is I have to check the invoice header to see if there are any tax, shipping and handling charges. If they are there I need to find out how much and distribute them across all the lines.
my flow was kind of like this
Loop over Invoice
[INDENT]Map ( get all headerCharges)
Branch (evaluate labels = true)
[INDENT]headerCharges > 0 SEQ:
[INDENT]Loop over InvoiceLine
[INDENT]Map (count invoice lines and gather charges)
[/INDENT]$default SEQ: (no headerCharges)
[INDENT]no work to do
If I move the loop above the branch it works, it is only when it is inside the branch that it doesnt work.
Seems like a scoping issue to me.
I’ll keep digging and if I find anything more I’ll post back in case someone else has the same issues.