From 820280e660464e2d7096f7f1b85214c65b43a55a Mon Sep 17 00:00:00 2001 From: Anbarasu Date: Tue, 27 Aug 2024 10:25:39 +0530 Subject: [PATCH] fix: load other aggregations even formula Column is error (#9343) --- packages/nocodb/src/db/aggregation.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/db/aggregation.ts b/packages/nocodb/src/db/aggregation.ts index 581938a6dc..e094e62d09 100644 --- a/packages/nocodb/src/db/aggregation.ts +++ b/packages/nocodb/src/db/aggregation.ts @@ -8,7 +8,12 @@ import { UITypes, } from 'nocodb-sdk'; import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2'; -import type { BarcodeColumn, QrCodeColumn, RollupColumn } from '~/models'; +import type { + BarcodeColumn, + FormulaColumn, + QrCodeColumn, + RollupColumn, +} from '~/models'; import { Column } from '~/models'; import { NcError } from '~/helpers/catchError'; import genRollupSelectv2 from '~/db/genRollupSelectv2'; @@ -151,9 +156,14 @@ export default async function applyAggregation({ break; case UITypes.Formula: - column_name_query = ( - await baseModelSqlv2.getSelectQueryBuilderForFormula(column) - ).builder; + const formula = await column.getColOptions(context); + if (formula.error) { + aggregation = CommonAggregations.None; + } else { + column_name_query = ( + await baseModelSqlv2.getSelectQueryBuilderForFormula(column) + ).builder; + } break; case UITypes.LinkToAnotherRecord: