Merge pull request #9977 from Bchenjamin/nc-fix/sum-fails-9876

fix: Prevent sum from failing if field is blank
This commit is contained in:
Pranav C
2025-02-26 14:28:29 +05:30
committed by GitHub

View File

@@ -960,14 +960,26 @@ async function _formulaQueryBuilder(params: FormulaQueryBuilderBaseParams) {
{
type: JSEPNode.BINARY_EXP,
operator: '+',
left: pt.arguments[0],
left: {
type: 'CallExpression',
callee: { type: 'Identifier', name: 'COALESCE' },
arguments: [ pt.arguments[0], { type: 'Literal', value: 0 } ],
},
right: { ...pt, arguments: pt.arguments.slice(1) },
},
a,
prevBinaryOp,
);
} else {
return fn(pt.arguments[0], a, prevBinaryOp);
return fn(
{
type: 'CallExpression',
callee: { type: 'Identifier', name: 'COALESCE' },
arguments: [ pt.arguments[0], { type: 'Literal', value: 0 } ],
},
a,
prevBinaryOp
);
}
break;
case 'CONCAT':