• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] txt file splited in several txt files

#1 2012-03-01 19:21:48

rubensilva
Member
Registered: 2011-10-28
Posts: 70

[resolved] txt file splited in several txt files

Hello.
I have 1 txt file with 3 colunms, lets say, id;name;result
I want to split in several files by name;result

I have the context.name in a tjava_row

How can I transform this context in several files?

Thanks in advanced.

Offline

#2 2012-03-02 03:19:48

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] txt file splited in several txt files

Hi

Sorry. I can't catch your point.
Could you show us the usage of context.name?

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-03-02 11:00:22

rubensilva
Member
Registered: 2011-10-28
Posts: 70

Re: [resolved] txt file splited in several txt files

I was trying to use that context to distinct data from the input file, and to use it to give names to the splited files

Offline

#4 2012-03-02 12:02:57

shong
Talend team
Registered: 2007-08-29
Posts: 10294
Website

Re: [resolved] txt file splited in several txt files

Hi
Not need to use context variable, just iterate each row and set a dynamic output file path. The job design looks like:
tFileInputDelimited--row1(main)--tFlowToIterate--iterate--tFixedFlowInput--main--tFileOutputDelimed

on tFixedFlowInput, generate each row of input data, define two columns the schema, name and result.
key:value
name:(String)globalMap.get("row1.name")
result:(String)globalMap.get("row1.result")

on tFileOutputDelimited, set a dynamic output file path, for example:
"D:/file/"+(String)globalMap.get("row1.name")

Check the box 'append' on tFileOutputDelimited.

Best regards
Shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#5 2012-03-02 12:04:07

Or3l
Member
Registered: 2009-07-02
Posts: 216

Re: [resolved] txt file splited in several txt files

Hi,
You have  to create several output, don't think you can do it dynamically 'cause I don't know if it s possible to retrieve column name in talend.

Offline

#6 2012-03-02 13:00:41

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1121

Re: [resolved] txt file splited in several txt files

Or3l wrote:

Hi,
You have  to create several output, don't think you can do it dynamically 'cause I don't know if it s possible to retrieve column name in talend.

He wants the column data not the column name.

Offline

#7 2012-03-02 13:29:10

Or3l
Member
Registered: 2009-07-02
Posts: 216

Re: [resolved] txt file splited in several txt files

Yes of course but he also wants to name his files using the column's name.

Offline

#8 2012-03-02 14:42:13

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1121

Re: [resolved] txt file splited in several txt files

Or3l wrote:

Yes of course but he also wants to name his files using the column's name.

No he wants to name it by the value in column 'name'

Offline

#9 2012-03-02 16:32:29

Or3l
Member
Registered: 2009-07-02
Posts: 216

Re: [resolved] txt file splited in several txt files

Ok sorry didn't get the point !

Offline

#10 2012-03-03 21:30:51

rubensilva
Member
Registered: 2011-10-28
Posts: 70

Re: [resolved] txt file splited in several txt files

Hello,
shong, perfect!! It was exactly I need!

Thanks.

Offline

#11 2012-04-26 16:04:53

OttoOzaki
New member
Registered: 2011-09-08
Posts: 1

Re: [resolved] txt file splited in several txt files

shong wrote:

Hi
Not need to use context variable, just iterate each row and set a dynamic output file path. The job design looks like:
tFileInputDelimited--row1(main)--tFlowToIterate--iterate--tFixedFlowInput--main--tFileOutputDelimed

on tFixedFlowInput, generate each row of input data, define two columns the schema, name and result.
key:value
name:(String)globalMap.get("row1.name")
result:(String)globalMap.get("row1.result")

on tFileOutputDelimited, set a dynamic output file path, for example:
"D:/file/"+(String)globalMap.get("row1.name")

Check the box 'append' on tFileOutputDelimited.

Best regards
Shong

I have a problem just like this one but this solution does not work for me as I am working with huge files 1Gb+ , iterating with each row reduces the performance.
I am looking for a more dynamic way for this kind of process. Do you have any idea about how can I do it without iterating?

Offline

#12 2012-04-27 17:42:11

rubensilva
Member
Registered: 2011-10-28
Posts: 70

Re: [resolved] txt file splited in several txt files

Thanks Shong

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] txt file splited in several txt files

Board footer

Powered by FluxBB