Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Labels (2)
2 Replies
Anonymous
Not applicable
Author

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?
Anonymous
Not applicable
Author

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.
https://community.talend.com/t5/Design-and-Development/How-to-pick-up-value-of-one-column-where-anot...
Hope it helps.
Thanks
Vaibhav