custom calculation on OpenLab


i am new to Openlab and therefore trying to write up a custom calculation for spike and unspike samples using the area. i found one syntax in the community where it shows average but if one of my samples doesnt have the peak then result should be 0. instead i am getting a number which makes me think that may formula is incorrect. can someone please help. thanks. 

  • Hi  thank you for your question!  I moved it to the Chromatography Software Forum for better visibility.  Would you please let us know what version of OpenLab you are using?



  • Hello,

    You might want to look at moving to the latest version of OpenLab 2.x. The older versions had some limitations in CC when peaks were not found. Can you share your CC that is causing problems? The other possible problem is your filter is not limiting the values in your CC as you expected. You can use .count at the end of the expression instead of the current value to see how many terms you are including. You can see an example below where I am taking the average area of the standard peaks. To check my filter statements, I can use .count with the same expression to make sure I have only the areas of the 3 injections. If I want to see exactly what is in the selection, I can use the string.join and output the values as text with the same where and select statements. 


    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Injection.Sample.Sample_Type = 1).Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Select(function(x) x.Peak_Area).Average

    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Injection.Sample.Sample_Type = 1).Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Select(function(x) x.Peak_Area).Count

    String.Join("-",CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Injection.Sample.Sample_Type = 1).Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Select(function(x) Math.Round(x.Peak_Area, 4)))

  • hi martin, i was using the example below but it states for average. i dont want average of 3 for example. if one sample has no peak then the result should be zero instead i think because of the average in the formula, it is taking the average of the other injections into account when its completely separate samples. 

  • Hello,

    The point of my previous reply was to show you how to troubleshoot your expression. If you look at the count you can see how many values are in the average. You could also use the string.join to see exactly what values are being included to check your filters. I would create another CC with just the expression after Peak_Area - and look at the results to see what that expression is calculating. 

    Marty Adams

Was this helpful?