Selecting Top N Transactions from a transaction file

One Star

Selecting Top N Transactions from a transaction file

Hi, I have a transaction file containing cust_id and tran_amt columns, i want to pick top 3 transaction made by each cust_id. I have tried using tMap, tAggregated, but not able to get the correct results. can you suggest how do i achieve this.
Input Data
cust_id|tran_amt
1001|23
1001|24
1001|25
1004|67
1004|68
1004|69
1004|70
1004|71
1002|45
1002|46
1002|47
1002|48
1002|49
1003|55
1003|56
1003|57
1003|58
===============
Output Data
1001|25
1001|24
1001|23
1002|49
1002|48
1002|47
1003|58
1003|57
1003|56
1004|70
1004|69
1004|68
Regards
Sanjay
Seven Stars

Re: Selecting Top N Transactions from a transaction file

Use tFilterRow with the advanced expression:
Numeric.sequence(input_row.cust_id,1,1)<4

Re: Selecting Top N Transactions from a transaction file

Got it thanks Alevy...posted at 2 locations to get quick answers

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch