HowTo : Report the n Biggest Peaks of a sample analysis (OpenLab CDS Custom Calculator)

Document created by agilent Employee on Mar 28, 2016Last modified by agilent Employee on Mar 28, 2016
Version 3Show Document
  • View in full screen mode

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)


This CC:

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.


Regards, Pierre


(originally posted in OpenLAB Forum:

2015 July 29)