How to create a formula with calculations of custom fields values in OpenLab CDS

Hi 

 

am developing an intelligent report for quantification in OpenLAB CDS 2.4 and I want to include an acceptance criteria in my results table. The acceptance criteria will pass if the compound amount is within +/- 10% of a reference value.

 

I was able to do so when only one analyte is quantified (typing the reference value in  the sample amount section) using the following expression:

=Iif(Compound_Amount<=(Sample_Amount-(Sample_Amount*0.1)), Compound_Amount>=(Sample_Amount+(Sample_Amount*0.1)),"Pass"

 

However, I haven't been able to create a formula for when several analytes are quantified. I've created a compound custom parameter "Expected amount" to be able to give reference values to each of the quantifiable analytes and I have been able to use the expression to calculate accuracy but I need help creating the formula for the acceptance criteria.

 

=Iif(Compound_Amount<=(CFE((Compound_CustomFields),"ExpectAmt")-(0.1*CFE((Compound_CustomFields),"ExpectAmt"))), Compound_Amount>=(CFE((Compound_CustomFields),"ExpectAmt")+(0.1*CFE((Compound_CustomFields),"ExpectAmt"))),"Pass")

 

Thank you for your time

  • The below expression works fine on my system after I added a compound custom parameter named ExpectAmt:

     

    =IIf(Compound_Amount<=(CFE((Compound_CustomFields),"ExpectAmt")-(CFE((Compound_CustomFields),"ExpectAmt")*0.1)) OR Compound_Amount>=(CFE((Compound_CustomFields),"ExpectAmt")+(CFE((Compound_CustomFields),"ExpectAmt")*0.1)),"FAIL","PASS")

     

    You could also try using a nested if statement to see if that works better for you:

     

    =IIf(Compound_Amount<=CFE((Compound_CustomFields),"ExpectAmt")-(CFE((Compound_CustomFields),"ExpectAmt")*0.1),"FAIL",IIf(Compound_Amount>=(CFE((Compound_CustomFields),"ExpectAmt")+(CFE((Compound_CustomFields),"ExpectAmt")*0.1)),"FAIL", "PASS"))
  • Is the Compound Custom Parameter configured as a numeric?

     

     

    You could try using the Val() function around each instance of the custom parameter in the expression to see if that helps. 

  • Do you have any updates installed on your 2.4 system? There were a couple defects related to report template expression corruption that were fixed in 2.4 updates 6 and 7 which might help you in this situation. I would recommend that you install OpenLab CDS 2.4 Update 7 (which is the latest update) and see if that changes things. 

  • Hello,

     

    How often does your reference amount for the compounds change? If it never changes or changes on an infrequent basis I would suggest using a constants file in custom calculator. Also we have seen syntax issues with expressions in IR when using custom parameters so you might be experiencing that type of problem. You might want to try and do the calculation in CC instead of IR and then just report it. Here is an example of the calculation in CC. I split it out into 3 CCs and only went to a true/false result you could convert to PASS/FAIL in IR. You could do this in one step and use an IIF statement to get a pass/fail string if you wanted. I also show it both ways with a compound custom field and a constants file. The CCs ending in C are the expressions for using the constants file. The high limit is the same as the low with a plus replacing the minus between values.

     

    Marty Adams

     

    Eval

     

    Compound_Concentration >= LowLimit And Compound_Concentration <= HighLimit

     

    LowLimit

     

    CurrentPeakOrGroup.GetCustomField("Expected") - (CurrentPeakOrGroup.GetCustomField("Expected") * .1)

     

    EvalC

     

    Compound_Concentration >= LowLimitC And Compound_Concentration <= HighLimitC

     

    LowLimitC

     

    GetConstant("ExpectedValue") - (GetConstant("ExpectedValue") * .1)

     

     

     

  • Try using CDbl() insted of Val(). The latter had stopped working for me after some OpenLab update for whatever reason.

     

    The type of a Custom Parameter is always 'string' for the code no matter what you set in the Project settings. The project settings just define the input field validator.

     

    The code for extracting a CFE value should be the following:

    Code.CFE.ExtractValue((Compound_CustomFields),"Amount","String")

  • Thank you for all the responses!!

     

    Initially I updated the software to the Update 7 and unfortunately, the error continued. However after following Martin's suggestions I was able to create the report

     

    I thing it is easier to work with the CC calculations and then import the values in the IR than trying to create the expression in the IR.

     

    THANK YOU for your help the problem is now solved!!!!

Was this helpful?