Conversion error: query returned null, binding needs "double"

Hi all need a little help here.
I am using a Numeric Text field to display values but
I always get this error if the result is null, even I have tick the Fall back Value and set to 0

Exception: Conversion error: query returned null, binding needs “double”
on query binding for “StdUnit_Chart.Root Container.Container Chart.Container.Numeric Text Field 2.doubleValue”

This is my query:
SELECT
Sum(Scrap)
FROM Ignition_database
where Machine = ‘10’ and [Date] = ‘2017-07-10’

Does somebody has a work around for this or is there something that I am missing?

Try this:

SELECT 
COALESCE(Sum(Scrap), 0)
FROM Ignition_database
where Machine = '10' and [Date] = '2017-07-10'
3 Likes

@Slurpee, fallback is useful in case no values are returned (zero rows). While in your case, the SUM function always returns exactly 1 value; Null in case there is no data in your selection.

Also see this thread from a few days ago: SQL Query error handler?
Similar situation, but with the MAX function instead of SUM.

thanks a lot @PGriffith it works perfect…