Adding an extra column to the delimited input file
Hi,
I download tab delimited files from an ftp server. The number of columns in the files vary and are between 5 and 15 columns. Some of the files are as below.
YAHOO_keyword_20101127.txt --- contains 5 columns
YAHOO_detail_20101127.txt --- contains 8 columns
I am using tInputFileDelimited to read these files and change the encoding and delimiter of the file and writing to another file using tOutputFileDelimited.
I would like to add another column to the file created by tOutputFileDelimited component. The extra column will be the date (20101127)in the name of the file itself.
Here is an example of what I need to do.
Input File:
col1 col2 col3 col4 col5
a b c d e
b c d e a
Output File wanted:
col1 col2 col3 col4 col5 date_created
a b c d e 20101127
b c d e a 20101127
The date value comes from the file itself.
I would really appreciate if someone can help me with this. I was also trying to use the tmap component but was not able to achieve what I described above.
Thank you,
Santhosh.
where status is new column which I have to create.
how to do it?
Inside output column you can write expression
input_row.marks < 35 ?"30%"
input_row.marks > 35 & input_row.marks < 50)?"50%":some condition
This is cascaded if-then-else
previous column output = input column for that column, take that directly...
Thanks
vaibhav
Thanks for your reply Vaibav,
Example I'm using newcolumn=column5*100
where column5 is previous column in output.
Not only the multiplication I could not get any expression.It is showing me error as
Newcolumn cannot be resolved or not a field.
You must have added newcolumn in metadata in tMap output
- remove newcolumn= from expression and i assume that column5 is your name of previous column in metadata...
I am not sure why you can't display the screenshot of tMap, you can hide the fields if you have security issue... This way you can save time and efforts of many people.
thanks
vaibhav