Creating header record with flat file output

I’m hoping this is super simple…we’re new to webMethods (coming from Sterling Integrator) so I’m trying to migrate some processes over. Some of the jobs we have require flat files to be built from database extractions. I have the jdbc connections working and I’m able to create flat files (created a flat file dictionary, schema, and then document type). For some of the files I need to create a static header record that contains the field names and then all the data records from the jdbc extraction after.

So my question is how do I create the header record with the static field names as the first record? I’m not sure how or where to define this record. I thought about trying to hard code the values in the first iteration of the looping record but I’m not sure if that’s the best way or if I should somehow define the static record in the dictionary/schema somehow.

Hopefully I’m overthinking this and it’s easier than I’m making it. Any guidance and help would be GREATLY appreciated. Thanks in advance.

Damon

Hi Damon,

Greetings!

I think the solution is you can build a .csv (delimited) file (go with FF Dictionary/Schema Field reference with recordWithNoID (case sensitive) as your record header and then specify the Fields Indexing (0,1,2,3 …n etc…) and once you have the FF document type ready then individually map the elements output from your JDBC extraction and convertToString (which it outputs the FF string in the pipeline) for your downstream feeding what ever process you may have.

Is this suggested format looks promising for you?

HTH,
RMG

Thanks for the reply, RMG.

So using the ff dictionary/schema route, I have the records being created that contain the data. But I’m still not sure what you mean to create the header record with the field names. So it would look something like below. I need to create that first record with hard-coded values but I’m just not quite understanding how to map that record out before the actual data records below it from the jdbc extraction.

FirstName, LastName, EmpID, Location
Amy, Smith, 00001, Texas
John, Jones, 00002, California
Sam, Adams, 00003, Texas

Thanks for your help and sorry for so many questions.

Damon

So in this case what you can do is:

Add the first static record header in the .csv once you have the fully converted (FF string) from jdbc extraction and then use contact service and input string 1 with static header record (with all comma separated fields - FirstName, LastName, EmpID, Location) etc… and so in the final output you will have static header and also the jdbc extracted data for those underneath fields (in.csv format)

HTH,
RMG

Thanks for the response, RMG. It sounds like I have the larger part working (the creation of the file from the JDBC extraction). But I’m a little unclear on how to create that static record and what do you mean by the contact service with the input string? Are you saying to add all the files with the commas as a string and then append that string to the front of the jdbc extraction file? What is the contact service?

Again, I apologize for all the questions and confusion.

Thanks,
Damon

Hi Damon,

Sorry no I am saying the concatenation only for the static header fields (because you want the header in the output FF string) and remaining part of JDBC extraction activity should be mapped to the FF Document type (that you would be creating part of the delimited one like Field Delimiter is comma and record delimiter is new line feed) and once call the flatfile:convertToString
service output (FF string) map to the input to the string:concat service and set the static header you created above in the str1 and str2 would be the FF string and finally your output would be look like as per your example:

FirstName, LastName, EmpID, Location (static header fields with comma seperated)
Amy, Smith, 00001, Texas
John, Jones, 00002, California
Sam, Adams, 00003, Texas

Hope you are clear now?

HTH,
RMG