|
|
@ -722,10 +722,12 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
throw new FormulaError( |
|
|
|
throw new FormulaError( |
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
{ |
|
|
|
{ |
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
key: 'msg.formula.typeIsExpected', |
|
|
|
|
|
|
|
type: 'Numeric', |
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
position: 2, |
|
|
|
}, |
|
|
|
}, |
|
|
|
'Numeric type is expected' |
|
|
|
'The REPEAT function requires a numeric as the parameter at position 2' |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -1771,26 +1773,32 @@ export async function validateFormulaAndExtractTreeWithType({ |
|
|
|
`Field ${name} with ${argPt.dataType} type is found but ${expectedArgType} type is expected` |
|
|
|
`Field ${name} with ${argPt.dataType} type is found but ${expectedArgType} type is expected` |
|
|
|
); |
|
|
|
); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let key = '', |
|
|
|
let key = ''; |
|
|
|
message = 'Invalid argument type'; |
|
|
|
const position = i + 1; |
|
|
|
|
|
|
|
let type = ''; |
|
|
|
|
|
|
|
|
|
|
|
if (expectedArgType === FormulaDataTypes.NUMERIC) { |
|
|
|
if (expectedArgType === FormulaDataTypes.NUMERIC) { |
|
|
|
key = 'msg.formula.numericTypeIsExpected'; |
|
|
|
key = 'msg.formula.typeIsExpected'; |
|
|
|
message = 'Numeric type is expected'; |
|
|
|
type = 'numeric'; |
|
|
|
} else if (expectedArgType === FormulaDataTypes.BOOLEAN) { |
|
|
|
} else if (expectedArgType === FormulaDataTypes.BOOLEAN) { |
|
|
|
key = 'msg.formula.booleanTypeIsExpected'; |
|
|
|
key = 'msg.formula.typeIsExpected'; |
|
|
|
message = 'Boolean type is expected'; |
|
|
|
type = 'boolean'; |
|
|
|
} else if (expectedArgType === FormulaDataTypes.DATE) { |
|
|
|
} else if (expectedArgType === FormulaDataTypes.DATE) { |
|
|
|
key = 'msg.formula.dateTypeIsExpected'; |
|
|
|
key = 'msg.formula.typeIsExpected'; |
|
|
|
message = 'Date type is expected'; |
|
|
|
type = 'date'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
throw new FormulaError( |
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
type, |
|
|
|
key, |
|
|
|
key, |
|
|
|
|
|
|
|
position, |
|
|
|
calleeName, |
|
|
|
calleeName, |
|
|
|
}, |
|
|
|
}, |
|
|
|
message |
|
|
|
`${calleeName?.toUpperCase()} requires a ${ |
|
|
|
|
|
|
|
type || expectedArgType |
|
|
|
|
|
|
|
} at position ${position}` |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|