Browse Source

feat: formula - count method correction

pull/7019/head
Pranav C 1 year ago
parent
commit
e236880ad8
  1. 2
      packages/nc-gui/utils/formulaUtils.ts
  2. 2
      packages/nocodb/src/db/functionMappings/pg.ts

2
packages/nc-gui/utils/formulaUtils.ts

@ -542,7 +542,7 @@ const formulas: Record<string, any> = {
COUNT: { COUNT: {
validation: { validation: {
args: { args: {
rqd: 0, min: 1,
}, },
}, },
description: '', description: '',

2
packages/nocodb/src/db/functionMappings/pg.ts

@ -232,7 +232,7 @@ const pg = {
await Promise.all( await Promise.all(
pt.arguments.map(async (arg) => { pt.arguments.map(async (arg) => {
const { builder } = await fn(arg); const { builder } = await fn(arg);
return `CASE WHEN ${builder} IS NOT NULL AND ${builder}::text != '' THEN 1 ELSE 0 END`; return `CASE WHEN pg_typeof(${builder}) IN ('smallint', 'integer', 'bigint', 'decimal', 'numeric', 'real', 'double precision') AND ${builder} IS NOT NULL THEN 1 ELSE 0 END`;
}), }),
) )
).join(' + ')} ${colAlias}`, ).join(' + ')} ${colAlias}`,

Loading…
Cancel
Save