• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tSortRow with RowNumber

#1 2012-06-02 10:20:22

NitinMunjani
Member
Registered: 2012-04-28
Posts: 33

[resolved] tSortRow with RowNumber

Tags: [tsortrow]

Hello Talend Team,

I have csv delimiter file which contains column accountname and accountaddress. I want unique accountname with only one address details.

my csv data file

accountname   accountaddress
account1          add1
account1          add2
account2          add1
account2          add2
account1          add3

I want output file like

accountname  accountaddress
account1        add3
account2        add2

So I have designed my job like

tFileInputdelimiter --------------->tSortRow-------------->tUniqueRow---------------->tFileOutputdelimiter
                                               (accountname)           (accountname)

but its gives me output file as mentioned below with first address instead of last address.

accountname  accountaddress
account1        add1
account2        add1

please help me how I achieve output file with last address only or is there any way to sort by row number?

Thanks,
Nitin

Last edited by NitinMunjani (2012-06-02 10:29:26)

Offline

#2 2012-06-02 14:38:29

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

Re: [resolved] tSortRow with RowNumber

Hi
Yes, you can add an row number for each and sort by the row number. To do it:
1. Add a new column on the output table on tMap, let's call it 'row_number', set its expression as Numeric.sequence("s1",1,1)
2. On tSortRow component, sort by row_number with desc order.

Best regards
Shong


Uploaded Images


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

#3 2012-06-04 07:06:33

NitinMunjani
Member
Registered: 2012-04-28
Posts: 33

Re: [resolved] tSortRow with RowNumber

Thank you shong.

Last edited by NitinMunjani (2012-06-04 07:06:47)

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tSortRow with RowNumber

Board footer

Powered by FluxBB