Browse Source

fix(nocodb): groupby doesn't work if formula field dataType is numeric nocodb/nocodb#7382

pull/7500/head
Ramesh Mane 10 months ago
parent
commit
09e2fba5f1
  1. 12
      packages/nocodb/src/db/conditionV2.ts

12
packages/nocodb/src/db/conditionV2.ts

@ -1,4 +1,5 @@
import { import {
FormulaDataTypes,
isDateMonthFormat, isDateMonthFormat,
isNumericCol, isNumericCol,
RelationTypes, RelationTypes,
@ -447,7 +448,16 @@ const parseConditionV2 = async (
).builder; ).builder;
return parseConditionV2( return parseConditionV2(
baseModelSqlv2, baseModelSqlv2,
new Filter({ ...filter, value: knex.raw('?', [filter.value]) } as any), new Filter({
...filter,
value: knex.raw('?', [
// convert value to number if formulaDataType if numeric
formula.getParsedTree()?.dataType === FormulaDataTypes.NUMERIC &&
!isNaN(+filter.value)
? +filter.value
: filter.value || null, // in gp_null value is undefined
]),
} as any),
aliasCount, aliasCount,
alias, alias,
builder, builder,

Loading…
Cancel
Save