diff --git a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts index 08e5ef8588..3c5e49d503 100644 --- a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts @@ -578,11 +578,11 @@ async function _formulaQueryBuilder( const colAlias = a ? ` as ${a}` : ''; pt.arguments?.forEach?.((arg) => { if (arg.fnName) return; - arg.fnName = pt.callee.name; + arg.fnName = pt.callee.name.toUpperCase(); arg.argsCount = pt.arguments?.length; }); if (pt.type === 'CallExpression') { - switch (pt.callee.name) { + switch (pt.callee.name.toUpperCase()) { case 'ADD': case 'SUM': if (pt.arguments.length > 1) { @@ -661,13 +661,14 @@ async function _formulaQueryBuilder( break; } + const calleeName = pt.callee.name.toUpperCase(); return { builder: knex.raw( - `${pt.callee.name}(${( + `${calleeName}(${( await Promise.all( pt.arguments.map(async (arg) => { let query = (await fn(arg)).builder.toQuery(); - if (pt.callee.name === 'CONCAT') { + if (calleeName === 'CONCAT') { if (knex.clientType() !== 'sqlite3') { query = await convertDateFormatForConcat( arg, diff --git a/packages/nocodb/src/db/mapFunctionName.ts b/packages/nocodb/src/db/mapFunctionName.ts index 669442e157..c351cabbbc 100644 --- a/packages/nocodb/src/db/mapFunctionName.ts +++ b/packages/nocodb/src/db/mapFunctionName.ts @@ -20,7 +20,7 @@ export interface MapFnArgs { } const mapFunctionName = async (args: MapFnArgs): Promise => { - const name = args.pt.callee.name; + const name = args.pt.callee.name.toUpperCase(); let val; switch (args.knex.clientType()) {