diff --git a/libs/shared/lib/querybuilder/model/logic/general.ts b/libs/shared/lib/querybuilder/model/logic/general.ts index e0dee2de5153a6f7894e9986852ca2eb39d25e18..063bb32cd0fea1a2f43082a6a703832567a3ad15 100644 --- a/libs/shared/lib/querybuilder/model/logic/general.ts +++ b/libs/shared/lib/querybuilder/model/logic/general.ts @@ -47,6 +47,7 @@ export enum StringFilterTypes { EQUAL = '==', NOT_EQUAL = '!=', LIKE = 'Like', + EMPTY = 'IsEmpty', // NOT_LIKE = 'Not Like', // IN = 'In', // NOT_IN = 'Not In', @@ -108,7 +109,8 @@ export type LowerStatement = ['Lower', AnyStatement]; export type UpperStatement = ['Upper', AnyStatement]; export type SubstringStatement = ['Substring', AnyStatement, AnyStatement, AnyStatement]; export type TrimStatement = ['Trim', AnyStatement]; -export type AllStringStatement = ConcatStatement | LowerStatement | UpperStatement | SubstringStatement | TrimStatement; +export type EmptyStatement = [StringFilterTypes.EMPTY, AnyStatement]; +export type AllStringStatement = ConcatStatement | LowerStatement | UpperStatement | SubstringStatement | TrimStatement | EmptyStatement; // Dates export type DateStatement = ['Date', AnyStatement]; diff --git a/libs/shared/lib/querybuilder/model/logic/stringFilters.tsx b/libs/shared/lib/querybuilder/model/logic/stringFilters.tsx index 3012370e770541cbcb4a1b69ceae522a9d530a58..c0cc1e6c6e92a07a69400accf4ade0d5dcbc5dd2 100644 --- a/libs/shared/lib/querybuilder/model/logic/stringFilters.tsx +++ b/libs/shared/lib/querybuilder/model/logic/stringFilters.tsx @@ -54,6 +54,17 @@ export const StringFilters: Record<StringFilterTypes, GeneralDescription<StringF output: { name: StringFilterTypes.LIKE, type: 'bool' }, logic: [StringFilterTypes.LIKE, '@i', '@1'], }, + [StringFilterTypes.EMPTY]: { + key: 'stringFilterEmpty', + name: 'Is Empty', + type: StringFilterTypes.EMPTY, + description: 'Equal to an empty string or a NULL value', + input: { name: 'Value', type: 'string', default: '' }, + numExtraInputs: 0, + inputs: [], + output: { name: StringFilterTypes.EMPTY, type: 'bool' }, + logic: [StringFilterTypes.EMPTY, '@i'], + }, }; /** All available functions in the function bar. */