Convert document(record) to string

Hi,

I am stuck in a situation in shich i have to write a document(record)in WM 4.1 to an string. All the fields get appended to the string one after the other.
Please help me how to do that.

Your urgent help is appreciated.

Thanks & Regards
Amit

There is no such thing as WM 4.1.

Assuming you mean webMethods B2B 4.01, there is a pub.record:recordToXMLValues built-in service that might do what you need.

This is an ancient release of the product, so you may not easily be able to do what you want if that service does not do the trick.

Mark

Hi Mark,

Thanks for ur suggestions.
I want to convert the whole record to be written in the form of string to a file. For eg :- (Employee is the record)

Employee
Name AMIT
Adress PUNE
Emp ID 502545

I want the result as “AMITPUNE502545” to be in the text file.
How should i go for it…
Pls advice.

Thanks for your valuable guidance

Amit

Well, if you were using a more current release, you would use the Flat File Adapter. Since you using something from the dark ages, your options are very limited.

You can write a java service that will “walk” the structure of your record appending the value of each key to the string. I can’t tell you how to do that in B2B 4.0.1. You are using B2B, right?

Mark

Hi Amit
If you can find the service pub.string:makeString, then you have some luck. Add a MAP step and map the Employee/Name to stringList[0], Employee/Address to stringList[1], Employee/EmpID to stringList[2] and so on… then call the service pub.string:makeString and supply this stringList with no delimiter the output of this service will have all the values concatenated.

CAUTION: Keep in mind that if you don’t supply any delimeter as above, the resulting output string cannot by used for any parsing (until you know the lengths of the individiual fields and all the fields are of fixed width)

HTH,
Bhawesh.

Hi Bhavesh,

Thanks for our help. One more advice… Now if have given all the strings and i want to combine them in to a single string,. (Using “makestring” service) inserting newline “\n” after every element. what should be the separtaor to be specified.

i tried \n,’\n’,%nl%,etc they are not working. also tried using
\t,\r…

Pls. let me know the corrcet syntax.

Thanks for our help.

Regards
Amit

Amit,

Here is the trick for newline,in makeString service input for delim
do a setValue and rightclick view large editor and inside the box just hit enter and save it.

you should see the \n line delimiter for each record in the output.

HTH,
RMG