|
|
@ -321,7 +321,6 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 3, |
|
|
|
rqd: 3, |
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => { |
|
|
|
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
@ -377,6 +376,7 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 1, |
|
|
|
rqd: 1, |
|
|
|
|
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
syntax: 'DATESTR(date | datetime)', |
|
|
|
syntax: 'DATESTR(date | datetime)', |
|
|
@ -388,6 +388,7 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 1, |
|
|
|
rqd: 1, |
|
|
|
|
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
syntax: 'DAY(date | datetime)', |
|
|
|
syntax: 'DAY(date | datetime)', |
|
|
@ -399,6 +400,7 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 1, |
|
|
|
rqd: 1, |
|
|
|
|
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
syntax: 'MONTH(date | datetime)', |
|
|
|
syntax: 'MONTH(date | datetime)', |
|
|
@ -410,6 +412,7 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 1, |
|
|
|
rqd: 1, |
|
|
|
|
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
syntax: 'DAY(time | datetime)', |
|
|
|
syntax: 'DAY(time | datetime)', |
|
|
@ -425,7 +428,6 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
min: 2, |
|
|
|
min: 2, |
|
|
|
max: 3, |
|
|
|
max: 3, |
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => { |
|
|
|
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
@ -814,7 +816,6 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 0, |
|
|
|
rqd: 0, |
|
|
|
type: FormulaDataTypes.DATE, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
description: 'Retrieve the current time and day.', |
|
|
|
description: 'Retrieve the current time and day.', |
|
|
@ -882,8 +883,29 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 2, |
|
|
|
rqd: 2, |
|
|
|
type: FormulaDataTypes.STRING, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
custom(argTypes: FormulaDataTypes[], parsedTree) { |
|
|
|
|
|
|
|
if (argTypes[0] !== FormulaDataTypes.STRING) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.stringTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'String type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (argTypes[1] !== FormulaDataTypes.NUMERIC) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'Numeric type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
description: 'Retrieve the last n characters from the input string.', |
|
|
|
description: 'Retrieve the last n characters from the input string.', |
|
|
|
syntax: 'RIGHT(str, n)', |
|
|
|
syntax: 'RIGHT(str, n)', |
|
|
@ -897,8 +919,29 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 2, |
|
|
|
rqd: 2, |
|
|
|
type: FormulaDataTypes.STRING, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
custom(argTypes: FormulaDataTypes[], parsedTree) { |
|
|
|
|
|
|
|
if (argTypes[0] !== FormulaDataTypes.STRING) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.stringTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'String type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (argTypes[1] !== FormulaDataTypes.NUMERIC) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'Numeric type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
description: 'Retrieve the first n characters from the input string.', |
|
|
|
description: 'Retrieve the first n characters from the input string.', |
|
|
|
syntax: 'LEFT(str, n)', |
|
|
|
syntax: 'LEFT(str, n)', |
|
|
@ -913,7 +956,38 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
min: 2, |
|
|
|
min: 2, |
|
|
|
max: 3, |
|
|
|
max: 3, |
|
|
|
type: FormulaDataTypes.STRING, |
|
|
|
}, |
|
|
|
|
|
|
|
custom(argTypes: FormulaDataTypes[], parsedTree) { |
|
|
|
|
|
|
|
if (argTypes[0] !== FormulaDataTypes.STRING) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.stringTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'String type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (argTypes[1] !== FormulaDataTypes.NUMERIC) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'Numeric type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (argTypes[2] && argTypes[2] !== FormulaDataTypes.NUMERIC) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'Numeric type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
description: |
|
|
|
description: |
|
|
@ -933,8 +1007,31 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
validation: { |
|
|
|
validation: { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
rqd: 3, |
|
|
|
rqd: 3, |
|
|
|
type: FormulaDataTypes.STRING, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
custom(argTypes: FormulaDataTypes[], parsedTree) { |
|
|
|
|
|
|
|
if (argTypes[0] !== FormulaDataTypes.STRING) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.stringTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'String type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
for(const i of [1,2]) { |
|
|
|
|
|
|
|
if (argTypes[i] !== FormulaDataTypes.NUMERIC) { |
|
|
|
|
|
|
|
throw new FormulaError( |
|
|
|
|
|
|
|
FormulaErrorType.INVALID_ARG, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
key: 'msg.formula.numericTypeIsExpected', |
|
|
|
|
|
|
|
calleeName: parsedTree.callee?.name?.toUpperCase(), |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'Numeric type is expected' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
description: 'Extracts a substring; an alias for SUBSTR.', |
|
|
|
description: 'Extracts a substring; an alias for SUBSTR.', |
|
|
|
syntax: 'MID(str, position, [count])', |
|
|
|
syntax: 'MID(str, position, [count])', |
|
|
@ -1052,7 +1149,6 @@ export const formulas: Record<string, FormulaMeta> = { |
|
|
|
args: { |
|
|
|
args: { |
|
|
|
min: 1, |
|
|
|
min: 1, |
|
|
|
max: 2, |
|
|
|
max: 2, |
|
|
|
type: FormulaDataTypes.NUMERIC, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
custom(_argTypes: FormulaDataTypes[], parsedTree: any) { |
|
|
|
custom(_argTypes: FormulaDataTypes[], parsedTree: any) { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
|
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) { |
|
|
|