Flatfile format

Hi All
I am using wmFlatFile converToString service to convert my xml to a flatfile.Its working fine am I am getting the following result.
2004/04/05",“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416912,“CB00001842”

But the client requirement is to have the field name at the first line like following

OrderDate",“ShipDate”,“OrderNbr”,“CustPoNbr”
2004/04/05",“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416912,“CB00001842”

Is there any thing can I use in schema or convertToString service to get the desired result? I am using dictionary to create my schema and my schema document is having the first documentlist as recordWithNoID.

Any help would be appreciated

Thanks
Gupta

In the FlatFile Schema it self create a header record with corresponding FieldDefinitions and mention these
OrderDate,ShipDate,OrderNbr,CustPoNbr… and in the mapping setValue default values (“OrderDate”,“ShipDate”,“OrderNbr”,“CustPoNbr”).So these rows will be detail records
2004/04/05",“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416912,“CB00001842”

And make sure the number of header fields corresponds the detail fields so that they will be underneath the corresponding headers.

Finally the WmFlatFile (convertToString)service based on the above created schema it will show as you expected.

“OrderDate”,“ShipDate”,“OrderNbr”,“CustPoNbr”
2004/04/05",“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416895,“CT00001153”
“2004/04/05”,“2004/04/06”,416912,“CB00001842”

Test this scenario,and hopefully this will work.

HTH,

I can think of two ways of doing it.

  1. After you do convertToString, you have to call string manipulation functions to insert the header string before at position 0. This is easy and quick solution.
  2. Create a new record in the flat file schema for header string. Set max repeats to 1, make it mandatory. After doing this you may have to modify the input to converToString (ffData). This may help in column alignment.

-Ramesh

Sanjay,

My above posting and Ramesh’s option2 both are telling the same logic,so try to implement this way and it will be no complicated and also fits perfectly with the alignment in the flatfile.

I have to convert a xml doc to flat file…for that how to create a flat file schema…plz guide me…coz am not familiar wiht wM6.1

Thanks in advance
Alex

Alex,

I would suggest to read wM flat file schema developers guide.

  1. Itendify the record structure.(like length of each record and record/field delimiters etc.)
  2. Come up with record identifying rule (e.g how would you differentiate order header record from order detail, for this you can come up with some thing like, if record begins with H, it is header and if it begins with D, it is detail record.)
  3. Create FF schema and then create IS doc type from schema. (If you plan to reuse the field definitions or record structure in another flat file, think about creating Dictionaries)
  4. Create flow service to map data from XML to IS doc type.
  5. Call convertToString function to creat flat file.

Alex,

Please look into WmFlatFileSamples package provided with 6.1 Standard installation,this pack has some sample flows and it is also mapping from XML to FlatFile(PurhaseOrder).Try to explore on it.

Also go thru the ISFlatFileSchemaGuide.pdf documentation for more help.

If u have any questions take wmusers help…

HTH,