Excluding Peaks in custom field formulas

Can anyone clarify using Boolean functions in intersample custom fields? I'm trying to create a cf that will only populate in CCalRef1[Area} ie A.%.SAME(CCalRef1[Area]) and I don't want it populated for ANY other peaks in the chromatogram. When I tried this I got a value for the CCalref1 area fine but it was also populated for all other peaks. So I rewrote the formula as:

EQ(Area,CCalRef1[Area])*A.%.SAME(CCalRef1[Area])+NEQ(Area,CCalRef1[Area])*-1*50000.

This put a 0 in all the other peaks when I wanted it blank so I activated All or Nothing and it worked, I presume because its an addition formula and will either produce a result if all conditions are present or none at all, therefore if the peak ISNT CCalref1 then all conditions aren't satisfied hence blank. If I didn't specify with the Boolean before and after the formula (ie all or nothing with just A.%.SAME(CCalref1[Area]) then I have the same issue with the value populated in ALL peaks,


When I changed it to a & before the NEQ part I got 0.00 for everything! I don't know why though, any ideas? Ive seen formulas in Waters slides such as LT(Area,Caffeine[Area])*((EQ(Area,CAffeine[Area])+NEQ(Area,Caffeine[Area])*-1*50000)) or similar but I couldn't get it to work for me.


Are Booleen variables in formulas really necessary and does it just take lots of practice to become accomplished in their use?

Best Answer

  • shaunwat
    Answer ✓

    For example 2: they are coding the false condition in order to get a blank result. Otherwise you get 0 for the cell. They must have had steps after this (data sorting / processing) where having a blank cell was important.

    For example 1: divide peak area by what appears to be a total accepted area. Add to the total area contributions from a, b, c, d, and e. However, if areas a+b+c+d+e are zero, then just return a blank cell.

    I'm not sure what example 1 actually buys you or why you would want to use that approach. It seems to me there is a much easier way when taken out of context.

Answers

  • Try this type of qualifier code....
    EQ([Name],”peak name”)


  • shaunwat
    edited October 2018

    Your first custom field works because it should, but you need the "all or nothing" to kick off the -50,000 [blank cell] database translation.

    I'm having trouble following you past that point (if you didn't specify with the Boolean before and after...) and then when you changed it to a and before the NEQ?

    I would also step away form nested summary functions within these custom fields. If you want the Caffeine area thrown back out to you:

    EQ(Area,CCalRef1[Area])*1*Area + NEQ(Area,CCalRef1[Area])*-1*50000

    Only one condition is going to come true for the EQ portion of the field and that when the peak area is equal to CCalRef1, which you set as caffeine.

    The waters example you gave makes no sense. Coding with specific peak names is foolish because if you want to use this for Steroid A you need to recode and revalidate. Always code as generically as you can!

    LT(Area,Caffeine[Area])*((EQ(Area,CAffeine[Area])+NEQ(Area,Caffeine[Area])*-1*50000))

    IF area is less than Caffine Area, then multiply by area equal to Caffeine area --- huh? This will create a mess of things when the area is greater than caffeine area. Furthermore, this essentially creates 1*1 when both conditions are true, which probably isn't what anyone is after... unless you are going to then key off this custom field... for example: EQ(Custom_Filed_Z,1)*area.

    Then we have ... IF area is not equal to caffeine area, then go away --- okay, got that.

    These are the most common type of custom fields that I deploy anymore. I've used them extensively to setup dissolution calculations without the dissolution option for Empower.  

  • Hi Shanuwat thanks for the reply. To clarify, I need to edit the examples given as they weren't quite right. These are two of the examples from a Waters slidepack in full, I still don't understand whats going on at the end of it and is it one of those fields that could be made a bit simpler:

    EXAMPLE 1

    Product and Impurities are known (a,b,c,d,e), unknowns are excluded from the equation. In the proc method create a named group including all knowns and call it "Product and Impurites", then the formula becomes:


    Area/Product_And_Impurites[Area]+EQ((EQI(Name,"a")+EQI(Name,"b")+EQI(Name("c")+EQI(Name,"d")+EQI(Name,"e")),0)*-1*50000. 

    Can you clarify whats going on here because I cant understand with all the extra bracketing what exactly the code is doing? Why put in BOTH EQ and EQI?

    EXAMPLE 2

    Example using the Wildcard and Or(|) operator in Boolean cfs. 

    A series of samples labelled as A1, A2...AN, B1,B2...BN, C1,C2....CN (where N is less than 10).Calculate average area of Uracil peak for samples labelled as A, average area of caffeine for samples labelled as B and average area of methanol for samples labelled as C but only return the result at Lines AN, BN, CN etc. 

    Formula:

     EQ(Name,"Uracil")*A?.%..AVE(Area)+EQ(Name,"Caffeine")*B?.%..AVE(Area)+EQ(Name"Methanol")*C?.%..AVE(Area)+LT((NEQ(Label,"AN")|NEQ(Label"BN")|NEQ(Label"CN"),1)*-1*50000.


    I take it from the last part of that formula that if the combination of NEQ(Label,AN,BN andCN is not true ie 0, then any label that ISNT AN etc is multiplied by -50000, blank? Seems a complicated way to achieve this. If it were me I would code it as:

    (EQ(Name,"Uracil")&EQ(Label,"AN"))*A?.%..AVE(Area)+(EQ(Name,"Caffeine")&EQ(Label,"BN"))*B?.%..AVE(Area)+etc etc. 





  • Am I missing something here - I'm thinking (as I frequently do) that this is much more easily handled via processing method and (if needed) report method filtering?
  • Yes Dan, I try to use the report method for these things but I need the custom field result for another related custom field as well so the calculation wouldn't stop at that result.
  • Thanks shaunwat, it also seems very long winded to me as well, I suppose there are so many ways to code custom fields that a very long process can still get you to the same destination as a simple one.