From 20f1c04e7e65ec507c8801ac4ac3177969262a3a Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 21 Dec 2023 09:17:02 +0000 Subject: [PATCH] fix: method usage correction --- packages/nocodb-sdk/src/lib/formulaHelpers.ts | 1 + .../nocodb/src/db/formulav2/formulaQueryBuilderv2.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/formulaHelpers.ts b/packages/nocodb-sdk/src/lib/formulaHelpers.ts index b7f96413f6..1775c57a8a 100644 --- a/packages/nocodb-sdk/src/lib/formulaHelpers.ts +++ b/packages/nocodb-sdk/src/lib/formulaHelpers.ts @@ -1202,6 +1202,7 @@ export function validateFormulaAndExtractTreeWithType({ | 'oracledb' | 'mariadb' | 'sqlite' + | 'snowflake' | typeof MysqlUi | typeof MssqlUi | typeof SnowflakeUi diff --git a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts index f6688082a3..b9294e6591 100644 --- a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts +++ b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts @@ -21,6 +21,7 @@ import { validateDateWithUnknownFormat, } from '~/helpers/formulaFnHelper'; import FormulaColumn from '~/models/FormulaColumn'; +import { Source } from '~/models'; const logger = new Logger('FormulaQueryBuilderv2'); @@ -76,10 +77,13 @@ async function _formulaQueryBuilder( // formula may include double curly brackets in previous version // convert to single curly bracket here for compatibility // const _tree1 = jsep(_tree.replaceAll('{{', '{').replaceAll('}}', '}')); - tree = validateFormulaAndExtractTreeWithType( - _tree.replaceAll('{{', '{').replaceAll('}}', '}'), + tree = validateFormulaAndExtractTreeWithType({ + formula: _tree.replaceAll('{{', '{').replaceAll('}}', '}'), columns, - ); + clientOrSqlUi: await Source.get(column.source_id).then( + (source) => source.type, + ), + }); // populate and save parsedTree to column if not exist if (column) {