Get second highest value

This example shows how you retrieve the second highest peak area from a number of peaks.

  1. Create a table with at least the following columns, in the order shown below. Sort the table by Area, in descending order.

    a. Retention time (RT)

    b. Count

    c. Area

    1. Retention time (RT)

    2. Count

    3. Area

  2. Save the retention time as an aggregator:

    1. Go to the properties of the RT column, and click fx to open the Expression Editor for the value.

    2. Click Save Expression Result As, select Aggregator, and provide a name. For example, MyRetentionTimes.

  3. Add the counter:

    1. Go to the properties of the Count column, and click fx to open the Expression Editor for the value.

    2. Use a count function. For example, =Count(MyRetentionTimes)

  4. Get the second value and save it as an aggregator.

    1. Go to the properties of the Area column, and click fx to open the Expression Editor for the value.

    2. Use the following expression to get the second value, rounded to 3 decimals: =iif(Count(MyRetentionTimes)=2, Round(Peak_Area,3), 0)

      For the 2nd row of the table, this expression returns the peak area. For all other rows, it returns 0.

    3. Save the expression result as an other aggregator, for example NBiggestArea

  5. Show the value:

    • Under the table, add a text field having the expression =Max(NBiggestArea)

Further options

  • If you have several detectors, select both table and text field, and group these two items. Repeat the group for each signal name.

    Add other text fields to the group as required.

  • If you want to use the table just to save the value, you can hide it. In the Properties dialog under Advanced clear the Visible check box.

  • If you want to get the nth biggest value, create a report parameter (for example, n). Use the following expression in your template: =iif(Count(MyRetentionTimes)=n, Round(Peak_Area,3), 0)