[resolved] write string to text file

One Star

[resolved] write string to text file

I require to format my variables from a database table inserting them into a text file (not csv)
How can I simply write a text file? I want to format it the same as you would format an email. Is this an existing feature?
(I am using a java project).
Thank you for any help.

Accepted Solutions
Community Manager

Re: [resolved] write string to text file

Hello,
tFileList----iterate(x 5)-----tFileInputDelimeted---row------SOMEPROCESSING--------tMysqlOutput(parallel execution enabled.)
Is there any way to do that.
Thanks

You can create the job like this:
main job:
tFileList--iterate--tRunJob_1
tRunJob_1: call the child job and pass the current file path (and the current file name) to the child job for use later, uncheck the 'die on error' option.
child job:
tFileInputDelimited--main-->someprocessing-->tMysqlOutput
--onsubjobok-->tFixedFlowInput_1---main-->tFileOutput
--onsubjoberror_>tFixedFlowInput_2_-->main-->tFileOutput
check the 'die on error' option both on tFileInputDelimited and tMysqlOutput
on tFixedFlowInput_1, define two column or more columns depends on your need, let's define two column:
filename: set the value with current file name or file path
status: set the value as "success"
on tFixedFlowInput_2, define two column or more columns depends on your need, let's define two column:
filename: set the value with current file name or file path
status: set the value as "failure"
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] write string to text file

Hello
I require to format my variables

What do you mean here? Can you give us an example?
inserting them into a text file (not csv)

Just use a tFileOutputDelimited to output a file, set the extension of file name as: .txt

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] write string to text file

basically I have 2 tables, from the first table I must pull a row of data, then pull all the corresponding data in the second table.
From the first table I must make a text output similar to this:
client_nr=1
branch_nr=1
sent=0303030303
ordered=202020202
then for every row from the second database I must output something similar to
rowDetails=1,2,3,4;
The tfileoutputdelimited I shall look into, if you have a better idea now seeing the format which I require please do let me know.
Community Manager

Re: [resolved] write string to text file

Hello
You can do a a join, add new columns and set fixed value on tMap, eg:
add a new column called key and set a fixed value base on row number.
On the tFileOutputDelimited, define the field separator as "=".
If you give me an example of your first table and second table, and what your output file looks like, I can give you a demo.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] write string to text file

Hello,
i am creating a Job for processing of files , process it , save it in db.
While doing this i want to log filename with their status like they processed successfully or not in a file or DB.
tFileList----iterate(x 5)-----tFileInputDelimeted---row------SOMEPROCESSING--------tMysqlOutput(parallel execution enabled.)
Is there any way to do that.
Thanks
Community Manager

Re: [resolved] write string to text file

Hello,
tFileList----iterate(x 5)-----tFileInputDelimeted---row------SOMEPROCESSING--------tMysqlOutput(parallel execution enabled.)
Is there any way to do that.
Thanks

You can create the job like this:
main job:
tFileList--iterate--tRunJob_1
tRunJob_1: call the child job and pass the current file path (and the current file name) to the child job for use later, uncheck the 'die on error' option.
child job:
tFileInputDelimited--main-->someprocessing-->tMysqlOutput
--onsubjobok-->tFixedFlowInput_1---main-->tFileOutput
--onsubjoberror_>tFixedFlowInput_2_-->main-->tFileOutput
check the 'die on error' option both on tFileInputDelimited and tMysqlOutput
on tFixedFlowInput_1, define two column or more columns depends on your need, let's define two column:
filename: set the value with current file name or file path
status: set the value as "success"
on tFixedFlowInput_2, define two column or more columns depends on your need, let's define two column:
filename: set the value with current file name or file path
status: set the value as "failure"
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Re: [resolved] write string to text file

Thanks Shong, for replying.
The above setup works.
Thanks again.

Re: [resolved] write string to text file

Hi Shong,
Above setup works fine.
But the thing is that, when I tried to create a zip of all jobs using 'Build Job' Option in Talend and try to upload it in TAC, it is showing me an error like jobinfo.properties is missing at root.
but while creating individual Build of every jobs, jobinfo.properties is present in every zip file.
So, the question is how to upload and run all these jobs in TAC (Talend Administration Center)?
Hope you got the question.
Thanks.