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
Highlighted
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

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog