Concat variable with same name

Hi All,

In my environemnt there is an utility java service written in webMethods which has an output variable called CmdResult.

Now, this java service does some internal operations and the result of these operations are populated in the CmdResult output variable.

Problem is – on completion of internal operations, if the JAVA service gets more than one lines as result; it creates that many numbers of CmdResult variable. (It does not craete stringList)

So, upon executing this utility - I am getting more than one CmdResult variables in the Results Pen.

Now, I am facing a problem to concat all these CmdResult together.
As it is not string list, I am unable to use looping also.

Can anybody please advise on it. Please let me know if I m clear.

N.B: - I cant change the java service at all.

One solution (webMethods Flow Service based):
1. Take youyr result from Java Service and invoke documentToXMLString
2. With the string resulted at step 1. invoke xmlStringToXMLNode followed by xmlNodeToDocument where you can specify makeArrays and arrays input parameters.



Here’s a snippet you can use/tweak to convert multiple vars in the pipeline to a string list. I named it varsToList.
[highlight=java]IDataCursor idc = pipeline.getCursor();
String varName = IDataUtil.getString(idc, “varName”);
java.util.ArrayList l = new java.util.ArrayList(5);

// For every var in the pipeline with the name in varName, add it to the list
for(boolean haveElement = idc.first(varName); haveElement; haveElement=idc.first(varName))
idc.delete(); // Remove the current varName from the pipeline

// If we got any, convert to a string list and put in the pipeline using varName
if(l.size() > 0)
IDataUtil.put(idc, varName, (String)l.toArray(new String[l.size()]));
You pass in the name of the vars you want to collapse to a string list. It creates the list, uses the same name for the list, and removes all the string vars.

Rob/Ioan ----great – thanks a lot