Search code examples
talend

Get Column Header of file as rows in TALEND


Trying to get all column name from a file into distinct rows.

Using tfileinputdelimited and limit is set to 1 to only pick Header Row. Header row will be like COL1,COL2,COL3,COL4

Need to capture each in a distinct row and assign a sequence value.

Output: COL1,1 COL2,2 COL3,3 COL4,4

Note: Need to perform this for multiple files which might have different number of columns in the header.


Solution

  • The first step is to retrieve the header row as a single string, with a tFileInputDelimited using one column only in the schema and a delimiter different than the actual delimiter in the file, like a "@".
    Once you have the header row, you can pass it to tNormalize to convert the comma separated list to rows.
    The output from tNormalize can then go through a tMap in order to add a sequence number: enter image description here enter image description here enter image description here