Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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.
Labels (2)
29 Replies
Anonymous
Not applicable
Author

In the tMap, add a column to the output table and use the following for the expression: TalendDate.getCurrentDate()
Make sure the that you select 'OK' for propagating changes. Or in the Output component, click on 'Edit Schema' to ensure the column is there (if not, then add it). Also, make sure the data types are consistent. Hope this helps!
_AnonymousUser
Specialist III
Specialist III

Hi,
Using a source file we created a job and got the output. Next time when the updated source file comes with following updations:
1. with an extra column
2. names of 2 columns are different.

Can we use the same Job again using the same schema so that extra column is updated dynamically and no impact with 2 differing column names.
as it's an irritating and monotonous task to create the same job again.
Can any 1 help
Thanks in advance,
Anchit
Anonymous
Not applicable
Author

Hi Anchit
Welcome to Talend Community!
Dynamic Schema is only supported by Talend Integration Suite(Commercial Version).
In TOS, you have to set schema manually.
Next time, please create a new topic for your question. Thanks.
Regards,
Pedro
soujanyam
Contributor
Contributor

Hi all,
I have tab seperated input files and I'm using tFileInputDelimited to read them. I want to add some columns to the output file,for which I've to do some caluculations.For that I'm using tmap.
But I don't know how to add new columns and do caluculations for those columns.
For example I've 4columns
col1            col2          col3            col4
1                  2              3                4
The output file should be as
col1            col2          col3            col4                col5=col1*col3             col6=col1*col2*col3
1                  2              3                4                             3                                     6
How could I acheive it? Please anyone provide the solution to me.
Thanks in advance.                                    
Anonymous
Not applicable
Author

Hi,
Please check the example given in documentation below
http://www.talendforge.org/tutorials/tutorial.php?idTuto=7
In tMap output metadata below add new column and use row1.col1*row1.col3 for value in output column.
Vaibhav
soujanyam
Contributor
Contributor

Thanks for your reply vaibav,
I tried as mentoned in the link only.But I could not get want I want. While adding newcolumn it is showing like column5 cannot be resolved to be a variable.
What could I do?
Anonymous
Not applicable
Author

Please show the screenshot of your tMap
Vaibhav
soujanyam
Contributor
Contributor

Thanks for your prompt reply.
If I map the new column with input columns I'm getting output. But my doubt is I want to do the caluculation on previous column output
for example column4(output)=couln3*50
And one more thing I need to execute some if else conditions in my job for new columns
How could I do this?
soujanyam
Contributor
Contributor

One more is
For example I've marks list
if(marks<35)
status=30%;
else if(50>marks>35)
status=50%
where status is new column which I have to create.
how to do it?