Hi All,
I’m new to webMethods and I am stuck at something very basic.
I want to loop around the output of wm.server.ns:getPackages which is a document list and assign the pkg_name to a string. The loop works but although I can see the package names in the variables window I cant seen to get at the string values. I guess I need to map the Packages[i] to a document but have tried many attempts unsuccesfully. I must be missing something obvious.
webMethods 8.2
I’ve attached a word doc with some screen shots.
I had coded the flow service as you suggested and I can see the repeating ‘packages’ nodes, each with it’s two child nodes but no matter what format of path I use (in a debug step) or element I try to map I cannot get at the values. As you can see in the variables window, the values are there.
I’ve tried %pkg_name%, %packages/pkg_name% and %/packages/pkg_name% and checked ‘variable substitution’ but I always see the name of the variable and not the value. 2nd screen shot is of the server logs.
Please try it yourself and if you can get a degub or a map to work let me know either the path or format of duocument you’ve had to create to map the packages nodes to.
Thanks again for your help.
Frank.
I’d be happy for now just to get the name of the package in a string so I can debug to the logs or put it in a document I can refer to later.
Over time I’d like to write a service which iterates over packages and output some basic details. I’m using this to learn more about flow and how to navigate over data structures.
Do I have to map the packages data to a document before I can get access to it? If so what would the document look like. I’v tried several shapes but after the MAP statement it does not appear in the output pipeline or it does but it’s empty.
If you directly use the path of the document element as an input for another service, you need to set the “Enable Variable substituion” check box, other wise (of if the value of the element is empty) the name of the variable will remain in the string.
The correct path of the element can be evaluated by right clicking on the desired element and select “Copy”.
After that you can paste it into the string where it should appear and surround it with “%” as a marker for a variable.
If the source is a list, i.e. packages, you will need to loop over it to get access to each element in it.
If you exactly know which element you need you can reference it as %packages[index]/pkg_name%, by index starting with 0.
Hi Holger,
Thanks for helping.
Please have a look at the attachment. I’ve added a 4th screen shot. In the 1st screen shot variables window you can see the child nodes of ‘packages’ named ‘pkg_name’ and ‘pkg_type’.
I understand what you say about getting the path from within the loop but when I right click in the variables window on the child ‘pkg_name’ node during Debug there is only a ‘Copy Variable’ option which is not what I want. In the Pipeline window when I expand the ‘packages’ node it is empty so I cannot right click the expected child node.
I’m sorry if this is very basic I just don’t understand why I can see the child nodes and values in the Variables window but not in the pipeline window?
Thanks again.
Frank.