Max Value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-06-19 07:06 PM
The fastest way to find the highest number or max value, lets say between three number. Any help is appreciated.
BR
Zahib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
02-06-19 04:02 PM
Also, are you looking for the most efficient way to do this or just a way that works?
I'll give two quick options for now.
Option #1: Assuming that you do not care whether that highest number or max value is in the list more than once... Bring the numbers into a collection, where each number is on its own line. Then use the action 'Sort Collection' in the VBO 'Utility - Collection Manipulation'. Put the field name into the 'Sort Field' input. And put 'False' in the input 'Ascending Order' so that the highest number will be in the first row. The first row should be selected in the output collection. So, you should be able to use a calculation stage to get the value from the first row like '[Sorted Collection.FieldName]' to get the value. This of course ignores whether row 2, etc. also have the same value. But this is assuming you just want to know that value.
Option #2: The other way to do it that may or may not be more efficient is to (again put the numbers into rows of a collection first) loop through the collection and store the value into a data item each time you find that it is higher. You'd have a decision stage that compares the current number to the last highest number. If it is higher, then you replace the last highest number with the current number and then loop again.
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-19 01:25 PM
Mvh
Zahib
------------------------------
Zahib Sidiq
Associate
KPMG
Europe/Oslo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-19 01:29 PM
------------------------------
Dave Morris
3Ci @ Southern Company
Atlanta, GA
------------------------------
Dave Morris, 3Ci at Southern Company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
03-06-19 02:44 PM
------------------------------
Zahib Sidiq
Associate
KPMG
Europe/Oslo
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
07-09-20 10:05 PM
I have a similar question, but in this case, I'd like to get the corresponding value under Name in the row with the largest value under Age. I also want to get the Name and lowest value (a number) under Age. I used the sort utility already, so the collection is in size order. I just need to find a way to isolate the top row and the bottom row.
Hope you can help.
Thanks
------------------------------
Bernadette Stroeder
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-09-20 01:25 PM
Good luck!
------------------------------
Happy coding!
Paul
Sweden
------------------------------
Paul, Sweden
(By all means, do not mark this as the best answer!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
08-09-20 01:54 PM
------------------------------
Ami Barrett
Sr Product Consultant
Blue Prism
Plano, TX
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
09-09-20 11:02 AM
I'll try that! And thanks Ami, always good to get the background on limitations.
Regards
Bernadette
------------------------------
Bernadette Stroeder
------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
25-01-22 08:57 AM
I have similar use case to find the max date from collection of dates after sorting. Could you explain how you did the coding.
Thanks in Advance
Marina
------------------------------
Marina Dutta
------------------------------
