[resolved] tSortRow with RowNumber

One Star

[resolved] tSortRow with RowNumber

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

Accepted Solutions
Community Manager

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
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

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
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] tSortRow with RowNumber

Thank you shong.

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download