Taking the n biggest peak has always been a difficult process because peaks need to be sorted by descending order, and from this sorted list, the report need then to show only the n desired peaks.
An easy way, is to create a Custom Calculation (CC) that sort the list of peaks, and then checks if the current peak is part of that list. The CC expression is then a Boolean test in a Peak or group scope:
(CurrentInjection.AllPeaks.OrderByDescending(Function(p) p.Peak_Area)) .take(5).contains(currentpeakorgroup)
1. Creates a list of Peak_Area, in a the descending order
2. Takes the 5 biggest. But "5" can also be a Sample Custom Field for example
3. Test if the current peak is part of the list created
The result of the Custom Calculator will return "True", when the peak is part of the n biggest peaks, or "False" otherwise
In Intelligent Reporting, the 5 biggest peak spectra can then be reported by filtering the spectra with the following expression :
=CCR((Compound_CustomCalculationResults),"CC Name") = True
Only the 5 biggest peaks will be reported.
(originally posted in OpenLAB Forum: https://zohodiscussions.com/openlabcdsforum#Topic/68030000000191007
2015 July 29)