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
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.
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.
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.
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.
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 would suggest to read wM flat file schema developers guide.
Itendify the record structure.(like length of each record and record/field delimiters etc.)
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.)
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)
Create flow service to map data from XML to IS doc type.
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.