How to pick up value of one column where another columns value is max

Highlighted
Four Stars

How to pick up value of one column where another columns value is max

Hi there,
i'm trying to find a solution for the issue similar to the below one
i have two columns
A B
1 10
2 20
3 30
4 40
now i define another column C as A's value where B is maximum..
Like
now i wan't C's value to be 4
i'm trying to fix this using aggregaterow component. and filter
Please help me with this issue!
Thanks in adv.
Highlighted
Moderator

Re: How to pick up value of one column where another columns value is max

Hi,
If I understand your requirement very well, for your use case is the expected result:
A B
1 10
2 20
3 30
4 40
The max value is 4?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Four Stars

Re: How to pick up value of one column where another columns value is max

Hi Anugna,
Problem is interesting. I tried to make it bit difficult by changing the second column. Now my data is
A;B
1;10
2;5
3;30
4;20
And I want to display larger id is 3. Use tMemorizeRow component, set Row count to memorise for both columns to 2. Use tJavarow component and use the logic for identifying the maximum in Column B and set it to some context variable.
OnSubjobOk -- Print that context variable value.
See the attached screenshot for your reference.
Hope it helps
Thanks
Vaibhav
Highlighted
Five Stars

Re: How to pick up value of one column where another columns value is max

Or, if this is coming from a DB, you could very simply use the max analytic function(s) to do it... For example http://stackoverflow.com/questions/6198320/how-to-use-partition-by-or-max

2019 GARTNER 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

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog