MassHunter Report Builder expression for LoD

Hi everyone,

I'm new to Report Builder and I'm getting to grips with using expressions.

I would like all compounds in my MassHunter Quant method to appear in a table in my report, but the first cell of the row to be coloured green if the compound is above it's respective LoD, and the cell to be coloured red if below the LoD.

I spotted the cell formatting in the report template 'ScreeningGC_Summary' where cells are coloured depending on their status, so I'm hoping I can use this in a similar way. If not, a simple 'Yes' or 'No' would also work.

I've seen in the template 'Gen_Samples_AboveLOQ' that the following expression is used to report values above LoQ:

"ND" if BoundItems["TargetCompound"] is None or BoundItems["TargetCompound"].IsLimitOfQuantitationNull() else BoundItems["TargetCompound"].LimitOfQuantitation

It is my understanding that I can substitute the word Quantitation for Detection in the expression to get LoD, but it isn't the value itself that I want to show here.

Any pointers would be appreciated.

  • Hello  ,

    To color cells based on an outlier you will need to first make certain there is a peak found and that a value is entered for the LOD outlier. You will then need to check and see if the outlier itself has a value. Since the LOD outlier does not have a high limit, you just need to check if it exists, and if it does that means the result is below the LOD.

    In limited testing the following example will color the cell white if there is no peak found or no LOD limit entered, green if it is above LOD (no outlier found), or red if there is a value for OutlierBelowLimitOfDetection. You can adjust the conditions as you see fit, though the order of error checking matters. Make sure you start with checking to see if there is a peak before accessing any of its results, otherwise reporting will abort with an error.

    import System
    import clr
    clr.AddReference("System.Drawing")
    import System.Drawing

    if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() or BoundItems["cmp"].IsLimitOfDetectionNull():
        TemplateItems["Cell"].BackgroundColor = System.Drawing.Color.White
    else:
        if BoundItems["TargetPeak"].IsOutlierBelowLimitOfDetectionNull():
            TemplateItems["Cell"].BackgroundColor = System.Drawing.Color.Green
        else:
            TemplateItems["Cell"].BackgroundColor = System.Drawing.Color.Red

    This was tested in the Gen_ResultsSummary_ISTD template. You will need to change "TargetPeak" and "cmp" to match your template's Peak table and TargetCompound binding names respectively. 

Was this helpful?