Browse Source

refactor: split value and display

pull/6987/head
Pranav C 1 year ago
parent
commit
532d603a2d
  1. 2
      packages/nc-gui/components/smartsheet/grid/GroupBy.vue
  2. 15
      packages/nocodb/src/db/generateLookupSelectQuery.ts

2
packages/nc-gui/components/smartsheet/grid/GroupBy.vue

@ -247,7 +247,7 @@ const onScroll = (e: Event) => {
'font-weight': 500,
}"
>
{{ grp.key in GROUP_BY_VARS.VAR_TITLES ? GROUP_BY_VARS.VAR_TITLES[grp.key] : grp.key }}
{{ grp.key in GROUP_BY_VARS.VAR_TITLES ? GROUP_BY_VARS.VAR_TITLES[grp.key] : grp.key.replaceAll('___',', ') }}
</span>
</a-tag>
</div>

15
packages/nocodb/src/db/generateLookupSelectQuery.ts

@ -13,6 +13,8 @@ import genRollupSelectv2 from '~/db/genRollupSelectv2';
import { getAliasGenerator } from '~/utils';
import { NcError } from '~/helpers/catchError';
const LOOKUP_VAL_SEPARATOR = '___';
export default async function generateLookupSelectQuery({
column,
baseModelSqlv2,
@ -289,8 +291,9 @@ export default async function generateLookupSelectQuery({
return {
builder: knex
.select(
knex.raw("STRING_AGG(??::text, '___')", [
knex.raw('STRING_AGG(??::text, ?)', [
lookupColumn.title,
LOOKUP_VAL_SEPARATOR,
]),
)
.from(selectQb.as(subQueryAlias)),
@ -308,9 +311,10 @@ export default async function generateLookupSelectQuery({
return {
builder: knex
.select(
knex.raw("GROUP_CONCAT(?? ORDER BY ?? ASC SEPARATOR '___')", [
knex.raw('GROUP_CONCAT(?? ORDER BY ?? ASC SEPARATOR ?)', [
lookupColumn.title,
lookupColumn.title,
LOOKUP_VAL_SEPARATOR,
]),
)
.from(selectQb.as(subQueryAlias)),
@ -320,7 +324,12 @@ export default async function generateLookupSelectQuery({
selectQb.orderBy(`${lookupColumn.title}`, 'asc');
return {
builder: knex
.select(knex.raw(`group_concat(??, '___')`, [lookupColumn.title]))
.select(
knex.raw(`group_concat(??, ?)`, [
lookupColumn.title,
LOOKUP_VAL_SEPARATOR,
]),
)
.from(selectQb.as(subQueryAlias)),
};
}

Loading…
Cancel
Save