FlatFile Adapter

I am trying to write database table data to a flat file. The wmFlatFile package is frustrating to understand. Can anyone point me in the right direction.

btw, I am new to WM.

Thanks a bunch

Where exactly you got stuck?
If you didn’t start yet, you can follow this.

  1. Create an adapter service that queries records from your table.
  2. Define the flatfile schema you need and create a document out of it.
  3. In a flow service, query the table using the above adapter service. Loop over the results and map to the document fields.
  4. Finally you can use ‘convertToString’ flatfile adapter service and convert the document into a string.


Thanks alot. I did all of that. Here’s what is confusing me

  1. I don’t want any delimeters in the files. My output file has to show 1 column only.
  2. Where do I put the convertToString? in the loop?
  3. What is the last step i.e. creating the actual file? (I don’t wan’t to use FTP, just plain simple method to create a local file)


If you dont want any record identifiers or field delimiters, then

  1. create a dictionary that will have a record with one field.Set the field extractor to Nth Field and set the position ‘0’.
    2.Now go to your schema and in ‘Settings’ take the reference of this record from the above dictionary.
  2. In definiton tab, select ‘Delimiter’ as the parser and set ‘newline’ as the record delimiter.
  3. Create a document for this. A document with a doc list ‘recordWithNoID’ should be created with one field under it.
  4. In your flow service, in the loop step, take table records as ‘inArray’ and this flatfile document as ‘OutArray’.
  5. Inside the loop, take a map step and map the specific field from records to this document field.
  6. After the loop, use ‘convertToString’ and convert the flat file doc to string.
  7. Now you can create a java utility that saves a string to file. Use that and save the data to local file.

Go through flat file adapter guide.