From a1227609f992b412313845507abc3bd0a3f95ed8 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 10 Feb 2023 12:25:08 +0800 Subject: [PATCH] feat(nocodb): add blank & notblank logic --- .../src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts index b47277da18..8607fd61f9 100644 --- a/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts +++ b/packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/conditionV2.ts @@ -480,7 +480,6 @@ const parseConditionV2 = async ( case 'lte': qb = qb.where(field, customWhereClause ? '>=' : '<=', val); break; - case 'empty': if (column.uidt === UITypes.Formula) { [field, val] = [val, field]; @@ -499,6 +498,14 @@ const parseConditionV2 = async ( case 'notnull': qb = qb.whereNotNull(customWhereClause || field); break; + case 'blank': + qb = qb.whereNull(customWhereClause || field).orWhere(field, ''); + break; + case 'notblank': + qb = qb + .whereNotNull(customWhereClause || field) + .whereNot(field, ''); + break; case 'checked': qb = qb.where(customWhereClause || field, true); break;