getCustomField() syntax in CCF


(Open Lab CDS 2,5)

I'm trying to extract a value from a Sample custom parameter, so we can use it as an extra sample weight in our reports.
I know how to do this in the report, through filtering and making a variabele, but i would like to do it in the CCF. However i can't seem to get it to work.

So i have this, and this works: 

However this is only for current injection.
I have tried this: 

and this:

And a couple variations of them, but they never return any values.

Without the Val() in front of it all, i had this error, so i'm wondering if it even possible?

Would anyone here know how to fix it please?

Kind regards

  • Hello,

    The documentation is below and also an example where I used it as a filter in a Linq expression. In the example it was a sample custom field called %RSD.

    Standard syntax CurrentSample.GetCustomField("MyCustom")

    Marty Adams

    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Injection.Sample.GetCustomField("%RSD").ToUpper.Equals("Y")).Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Select(function(x) x.Peak_Area).Count

    GetCustomField(customfieldName as a string) as a string

    CurrentSample.GetCustomField("MyCustom") returns the value of customfield named "MyCustom" in the current sample

  • Hello Martin

    based on your example, it seems that if i use .AllidentifiedPeaks to start, it seems to work. I have verified this.
    Strange that it doesn't work if i start from .AllSamples or .AllinjectionsofType


  • Hello,

    When you create the linq expression you need to take into consideration the data structure. It is why in the expression below the first filter is x.Injection.Sample.GetCustomField("%RSD") but the compound name filter can be directly called under AllIdentifiedPeaks.

    Marty Adams

    CurrentSequence.AllIdentifiedPeaks.Where(function (x) x.Injection.Sample.GetCustomField("%RSD").ToUpper.Equals("Y")).Where(function (x) x.Compound_Name = CurrentPeakOrGroup.Compound_Name).Select(function(x) x.Peak_Area).Count

Was this helpful?