8 Replies Latest reply on Nov 7, 2017 7:00 AM by hexatriene

    Masshunter PDF report builder - How to reference a textbox?

    gchaplain

      Good Day,

       

      I'm trying to create an if function on a text box, for example:

       

      if Textbox3 is above 50 or below -50 report "A" else report "B".

       

      I am trying to get it to refernce a particular value in the report that changes in the list of results on every different sample.

      I cannot reference the ISTDResponsePercentDeviation directly as it says DBNull when trying to put it into an If function.

       

      If anyone can solve either referencing another textbox and creating an if function from there or help resolve the DBNull:

       

      Thanks in advance

       

      Grant

        • Re: Masshunter PDF report builder - How to reference a textbox?
          hexatriene

          Hey Grant,

          Can you send me the function you're trying? I'll take a look.

           

          Best,

          Matt

            • Re: Masshunter PDF report builder - How to reference a textbox?
              gchaplain

              yeh sure. Using the expression box, I want the ISTDPeak ISTDReponsePercentDeviation. I can get it from the Field Value options but I want to get it in an expression then I can apply a function like:

              "Pass" if BoundItems["ISTDPeak"].ISTDReponsePercentDeviation <-50 else "Fail"

              So the result would be Pass or Fail depending on whether the repsone was 50% below the ISTD response average of the calibration.

                • Re: Masshunter PDF report builder - How to reference a textbox?
                  hexatriene

                  Ok - so you are clearly aware that we have an outlier for exactly this deviation. In your Quant method - there is an outlier called 'ISTD Response Percent Deviation" with two limits Resp Min % Deviation and Resp Max % Deviation. This outlier metric is the measure of whether the internal standard response deviates more than the user defined percent limits from the average ISTD response calculated from the calibration samples (from the help, exactly what you're looking for).

                   

                  Because we have the outlier defined already - you don't need to do any IF/Else logic. You can just have the outlier change the color of the cell or display Pass/Fail - whatever.

                   

                  Check out the example of this in the shipping system suitability report template. If you click on the 'Resolution Front' expression - you can see the example:

                   

                   

                  Let me know if you have any follow-up questions.

                    • Re: Masshunter PDF report builder - How to reference a textbox?
                      gchaplain

                      I'll give it a go and see if it works.

                       

                      Thanks for your help.

                      • Re: Masshunter PDF report builder - How to reference a textbox?
                        gchaplain

                        I've tried to perform it and the color change works great.

                         

                        However I've created a multiple if expression previously and I can't see to get it to fit.

                        In this expression it consists of multple If statements and I'm not sure how to integrate the code you provided into it. Or at least have it state Pass/Fail rather than color change.

                        I have also tried to integrate the expression below (my long multiple if statement) into the Color coding with next to no success

                         

                        " " if BoundItems["sample"].SampleType == "DoubleBlank" else " "if BoundItems["sample"].SampleType != "Sample" and BoundItems["sample"].SampleType != "QC" and BoundItems["sample"].SampleType != "CC" and BoundItems["sample"].SampleType != "Blank" and BoundItems["sample"].SampleType != "DoubleBlank" and BoundItems["Compound"].CurveFitR2 >=+0.999 else "Pass" if BoundItems["sample"].SampleType =="CC" and BoundItems["Compound"].CurveFitR2 >=+0.999  and BoundItems["TargetPeak"].Accuracy >+95 else "Pass" if BoundItems["sample"].SampleType =="Blank" and BoundItems["Compound"].CurveFitR2 >=+0.999  and BoundItems["TargetPeak"].FinalConcentration <+5 else "Pass" if BoundItems["sample"].SampleType =="QC" and BoundItems["Compound"].CurveFitR2 >=+0.999  and BoundItems["TargetPeak"].Accuracy >+95 else " " if BoundItems["sample"].SampleType =="Sample" and BoundItems["Compound"].CurveFitR2 >=+0.999 else "Fail"

                         

                        Do you have any suggestions on how this can be done?

                         

                        Thanks

                          • Re: Masshunter PDF report builder - How to reference a textbox?
                            hexatriene

                            Hi again - this is a little beyond my expertise but I know that Python is extremely formatting dependent. Can I set you up with one of our reporting consultants to see if they can get you an answer? If so - can you give us a call (800-227-9770, option 3, then 2) and the call center can arrange a callback for you.

                              • Re: Masshunter PDF report builder - How to reference a textbox?
                                gchaplain

                                It's OK. I've figured out why it's doing it now. Some sample types didn't have the outlier applied to them. this meant that the DBNull error kept coming up as there was no error to correspond to it. By limiting to Samples or Blank or CC as a fisrt arguement, the report doesn't crash:

                                "Pass" if BoundItems["sample"].SampleType == "CC" and (BoundItems["ISTDPeak"].ISTDResponsePercentDeviation >-50 and BoundItems["ISTDPeak"].ISTDResponsePercentDeviation <+50) or BoundItems["sample"].SampleType == "Sample" and (BoundItems["ISTDPeak"].ISTDResponsePercentDeviation >-50 and BoundItems["ISTDPeak"].ISTDResponsePercentDeviation <+50) or BoundItems["sample"].SampleType == "Blank" and (BoundItems["ISTDPeak"].ISTDResponsePercentDeviation >-50 and BoundItems["ISTDPeak"].ISTDResponsePercentDeviation <+50) else "Fail"

                                 

                                Thanks for your help though, Iv'e used the code you rpovided previously with a different report, so thank you.