Trouble with PDF Report Builder method - DBNull.

I thought I had this wonderful template that worked to my liking when I was using the preview function in Report Builder, but now that I'm trying to use it to generate a real report I am encountering a problem. Any time there is a sample with null values for concentration or any of the other values in my template, I get an error saying "Error: The value for column 'FinalConcentration' in table 'Peak' is DBNull. How do I get my report to simply report a zero for such a value?

Parents
  • Hello ,

    Report Builder expressions do not automatically handle missing values or null database entries. You must check for these yourself. Most values have a IsValueNameNull() method that returns a boolean that can be used to check for no entry. There are examples in the shipping templates, such as this expression from the Gen_ResultsSummary_ISTD report template.

    "ND" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() else BoundItems["TargetPeak"].FinalConcentration

    This will either report the FinalConcentration or if no target peaks are found or there is no value calculated for the FinalConcentration then it will report 'ND' (Not Detected) for the result.

Reply
  • Hello ,

    Report Builder expressions do not automatically handle missing values or null database entries. You must check for these yourself. Most values have a IsValueNameNull() method that returns a boolean that can be used to check for no entry. There are examples in the shipping templates, such as this expression from the Gen_ResultsSummary_ISTD report template.

    "ND" if BoundItems["TargetPeak"] is None or BoundItems["TargetPeak"].IsFinalConcentrationNull() else BoundItems["TargetPeak"].FinalConcentration

    This will either report the FinalConcentration or if no target peaks are found or there is no value calculated for the FinalConcentration then it will report 'ND' (Not Detected) for the result.

Children
No Data
Was this helpful?