One Star

Output 'input' filename to table

I using a tfileinputdelimited to take the input from a text file, using t-replace to make some changes to it and using tmysqloutput to output it to a table.
This is what I want to do, I want to add a column to the table for all the entries which should have the name of the text file i am using in tfileinputdelimited.
Can I do that and if yes, how?
Could you also please tell me how to call a stored procedure from mysql?
Thanks so much
2 REPLIES
Community Manager

Re: Output 'input' filename to table

Hello
Can I do that and if yes, how?

Of course, there are several ways to finish it.
1)
tFileList_1--iterate-->tFileInputDelimited--->tMap--tMysqlOutput
on tFileList, choose the direcotry where the file locates on, set the file mask as file name.
on tMap, add a new column, set the expression as: ((String)globalMap.get("tFileList_1_CURRENT_FILE"))
2)
tFileProperties---tJavaRow
|
onsubjobok
|
tFileInputDelimited--->tMap--tMysqlOutput
on tJavaRow: globalMap.put("filename",input_row.basename);
on tMap, add a new column and set the expression as: (String)globalMap.get("filename")
Could you also please tell me how to call a stored procedure from mysql?

See the related 4278
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Output 'input' filename to table

If I go with the first option, that is tfilelist, I would still need to set the file mask as the file name for each job. What if I wanted to automate the complete process, can it in no way pick up the file mask automatically from Fileinputdelimited?