# Openlab CDS Custom calculation for % standard difference using response factors from 2 different standard preparations in a sequence

HI,

I am trying to perform a simple % difference calculation using response factors from 2 different standards in a sequence ((RF std1 - RF Std 2)/( Sum (RF Std1 + RF std 2)/2)) * 100.  I have been using a report to filter the two standards required for the standard agreement into a table and have custom calculated the response factor of each standard in another column, however i cant seem the get the syntax right for the custom calculation for standard agreement calculation. Does anyone know the correct code or how to do this in a simplified way.

Thanks

• Hello,

Are you trying to do this in IR or are you using custom calculator? In IR you would need to store the values as variables and then use the stored values for the calculation.

Marty

• HI, i was initially trying to do it in IR. I made a table in a report template that filters the 2 standard injections and then calculated the individual response factors. I then was trying to have another column that calculated the % difference (standard agreement). To be honest whichever way is easiest (IR or custom calcs) is fine.

• Hello,

This CC would work below for multiple compounds. The calculation would be done for all peaks in all injections but could be limited by using if statements as needed. This should not be needed as the calculation is fairly simple. In the example, I used the sample name as the filter but that could be changed. Please note if you have more than one injection with the same sample name in each CC the average of those values will be used. Once calculated the value can be added to your report.

Name RFbyCC Type Double Scope PeakorGroup

Compound_Area / Compound_CalibrationAmount

Name STD1 Type Double Scope PeakorGroup

CurrentSequence.AllIdentifiedPeaks.Where(function(x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Where(function(x) x.Injection.Sample.Sample_Name = "Standard50-1").Select(function(x) x.GetDoubleCC("RFbyCC")).Average

Name STD2 Type Double Scope PeakorGroup

CurrentSequence.AllIdentifiedPeaks.Where(function(x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Where(function(x) x.Injection.Sample.Sample_Name = "Standard100-1").Select(function(x) x.GetDoubleCC("RFbyCC")).Average

Name PerDiff Type Double Scope PeakorGroup

(STD1 - STD2) / ((STD1 + STD2) / 2) * 100