how to get the max value out of 6 fields from row in excel file

One Star

how to get the max value out of 6 fields from row in excel file

Hallo,
I have an excel file that contains 5000 rows with data about customers and each row contains the turnover from six years for each customer now I want to get the highest turnover out of this six years for each customer.
Which component should I use and how do I get the max?
Greetings
One Star

Re: how to get the max value out of 6 fields from row in excel file

I use tFileInputExcel -> tMap to filter not needed values and from tMap -> tJavaRow -> tMap to splitt the result to different files.
I think with tJavaRow I could get the max value out of the six columns and fill a new column (maxValue)
I`m not a Java Junky so hope someone can help me get the right code, I found this:
double[] myArray={field1, field2, field3, field4, field5, field6};
double max;
max = myArray;
for (int i =1; i < myArray.length; i++)
{
if (myArray > max)
max = myArray;
}
row1.maxValue=max;
Is this a simple way or is there another solution in Talend?
Four Stars

Re: how to get the max value out of 6 fields from row in excel file

Hi Loki,
Use tMemorizeRow component, which will solve your problem of comparing data, but you need to tweak the java code based on normal if-then-else logic. Please see the forum post with requirement to compare columns.
http://www.talendforge.org/forum/viewtopic.php?id=35034
Hope it helps.
Thanks
Vaibhav

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