Let me have a look on that. I will get back to you ASAP.
In the meantime sorted my table with descending values of the target field (Peak_AreaPercent) and I did this little Custom assembly to retrieve the desired value. Works fine but would love to eliminate any custom code dependencies…
Dim SortedArray(0) As Double
Public Function AddValue(ByVal VarValue As Double) As String
If IsNothing(SortedArray(0)) Then
SortedArray(0) = VarValue
' not there so add it
ReDim Preserve SortedArray(UBound(SortedArray) + 1)
SortedArray(UBound(SortedArray)) = VarValue
Catch ex As Exception
Function GetSortedValue(ByVal ValIndex As Integer) As Double
Dim nLoop As Integer
Catch ex As Exception
1 person found this helpful
Thank you for the custom assembly! This might be very helpful.
Saving the value of a nBiggest value in array is possible. You can then return this value as you wish in any field or table.
However, using this saved nBiggest value in a group or filter expression will not be possible due some limitation that the Microsoft renderer has (in Intelligent Reporting for OpenLAB ChemStation and EZChrom, we use this renderer to generate the report). This is why having this value in a custom assembly may be very useful. That limitation is addressed in OpenLAB CDS 2.x because, we have other calculation possibilities.
To come back to your request, and how to save the nBiggest value in an aggregator :
1. Create a table without group repeat criteria, but with a descending order sorting option on the array that you want to work with :
Peak area if you want to save the "n" biggest peak area in array
2. In this table, place at least the 3 following columns : RT, A column called "Count", and the peak area in the 3rd :
3. Go to the column "RT [min]" properties, and then in the value tab, click "fx" to go in the expression editor
4. In this expression editor, click "Save Expression Result As", an then save this expression as an Aggregator called for example "Count1", and click "save", "ok" to quit the exp. editor.
5. Go to the column "Count" properties, and in the value, retrieve the count function of the aggregator that you just created. Expression should be something like "=Count(Count1)"
6. Go to the Peak_Area column, and write this expression : "=IIF(Count(Count1)=2,Round(Peak_Area,3),0)" which returns the 2nd peak area of the aggregator, or 0 in the case the peak area is not the second.
7. In this Expression editor, click "Save Expression Result As", and save this expression as an Aggregator called "NBiggestArea" for example.
8. Add under the table, a text field having the expression "=Max(NBiggestArea)"
9. If you have several detector select both table and text field, and group these 2 items. In the group properties, select group repeat by "Signal_Name"
10. You can add, other text field to have the signal name in the composite group, as well as any cosmetic things if you want
11. If you just use this table to save the value, you can also hide the entire composite group, by goind in the advanced group properties, and uncheck the checkbox visible
12. You can also have the value "n" taken from a custom report parameter (you can change the value of the "n" desired peak area when manually generating your report) or a custom field (to change the "n" desired value from the acquisition").
Once this group hidden, if you need the "n" biggest peak area value, just recall "=Max(NBiggestArea)"
Well, aren’t you clever!!! I stared at this for an hour and never came up with that workaround! Thank you so much!In this case I think your little dance will do exactly what they need and remove the dependency… I’ll check it out!
Happy to provide silly little custom assemblies any time you want..
I updated the tags on this thread to make it easier to search.
How can I show only the 30 biggest peaks in the table based on the "area %" value ?
It would depends on the software you use.
Is it a ChemStation/EZChrom or OpenLab CDS v2.x?
OpenLab Chemstation v.C01.07
and the Intelligent Reporter version A.01.09.126
2 people found this helpful
To see only the n biggest peaks based on any criteria (usually as you mentioned the Peak Area or Peak Height), we would need to filter the results using a variable or an aggregator.
The ChemStation uses a Microsoft Reporting Services underneath Intelligent Reporting. And by using this reporting service, The CDS inherits from its limitations. Filtering based on variables is unfortunately not possible with the built-in functionality:
"Dataset and data region filter expressions cannot contain aggregate functions. Group filters are ignored when calculating aggregates for data regions."
This had been addressed in OpenLab CDS v2.x where an another reporting service is used.
For the ChemStation, you would need to use a workaround which is very well explained in the following document (thank you Bernhard Etrich):
How to .. hide a table row based on a calculated value OpenLAB CDS Intelligent Reporting)
I hope this helps.