From 2e79a236d630c7a349f181009f61ac1d3ce686e8 Mon Sep 17 00:00:00 2001 From: mertmit Date: Fri, 26 Jan 2024 21:38:14 +0000 Subject: [PATCH] fix: single query bt lookup --- packages/nocodb/src/db/BaseModelSqlv2.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index fcd8b0c6f6..fdf921ee2f 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -4636,6 +4636,7 @@ class BaseModelSqlv2 { protected async substituteColumnIdsWithColumnTitles( data: Record[], dependencyColumns?: Column[], + aliasColumns?: Record, ) { const modelColumns = this.model?.columns.concat(dependencyColumns ?? []); @@ -4648,6 +4649,12 @@ class BaseModelSqlv2 { const btMap: Record = {}; modelColumns.forEach((col) => { + if (aliasColumns && col.id in aliasColumns) { + aliasColumns[col.id].id = col.id; + aliasColumns[col.id].title = col.title; + col = aliasColumns[col.id]; + } + idToAliasMap[col.id] = col.title; if (col.colOptions?.type === 'bt') { btMap[col.id] = true;