|
|
@ -889,20 +889,26 @@ async function _formulaQueryBuilder( |
|
|
|
|
|
|
|
|
|
|
|
// if operator is == or !=, then handle comparison with BLANK which should accept NULL and empty string
|
|
|
|
// if operator is == or !=, then handle comparison with BLANK which should accept NULL and empty string
|
|
|
|
if (pt.operator === '==' || pt.operator === '!=') { |
|
|
|
if (pt.operator === '==' || pt.operator === '!=') { |
|
|
|
|
|
|
|
for (const operand of ['left', 'right']) { |
|
|
|
|
|
|
|
if ( |
|
|
|
|
|
|
|
pt[operand].dataType === FormulaDataTypes.BOOLEAN && |
|
|
|
|
|
|
|
pt[operand === 'left' ? 'right' : 'left'].dataType === |
|
|
|
|
|
|
|
FormulaDataTypes.NUMERIC |
|
|
|
|
|
|
|
) { |
|
|
|
|
|
|
|
pt[operand === 'left' ? 'right' : 'left'] = { |
|
|
|
|
|
|
|
type: 'CallExpression', |
|
|
|
|
|
|
|
arguments: [pt[operand === 'left' ? 'right' : 'left']], |
|
|
|
|
|
|
|
callee: { |
|
|
|
|
|
|
|
type: 'Identifier', |
|
|
|
|
|
|
|
name: 'BOOLEAN', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
dataType: FormulaDataTypes.BOOLEAN, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (pt.left.callee?.name !== pt.right.callee?.name) { |
|
|
|
if (pt.left.callee?.name !== pt.right.callee?.name) { |
|
|
|
// if left/right is BLANK, accept both NULL and empty string
|
|
|
|
// if left/right is BLANK, accept both NULL and empty string
|
|
|
|
for (const operand of ['left', 'right']) { |
|
|
|
for (const operand of ['left', 'right']) { |
|
|
|
if (pt[operand].type === FormulaDataTypes.BOOLEAN) { |
|
|
|
|
|
|
|
pt[operand] = { |
|
|
|
|
|
|
|
type: 'CallExpression', |
|
|
|
|
|
|
|
arguments: [pt[operand]], |
|
|
|
|
|
|
|
callee: { |
|
|
|
|
|
|
|
type: 'Identifier', |
|
|
|
|
|
|
|
name: 'BOOLEAN', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( |
|
|
|
if ( |
|
|
|
pt[operand].type === 'CallExpression' && |
|
|
|
pt[operand].type === 'CallExpression' && |
|
|
|
pt[operand].callee.name === 'BLANK' |
|
|
|
pt[operand].callee.name === 'BLANK' |
|
|
|