From ee5cfd16ff1b533050026fc386e513fb8a1a3d41 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 3 Dec 2018 20:17:59 +0000 Subject: [PATCH] --- .../core-list-graph-datatable-filtering-paging.txt | 7 +++++-- server/AyaNova/biz/DataFilterBiz.cs | 4 ++-- server/AyaNova/biz/FilterSqlCriteriaBuilder.cs | 11 +---------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/devdocs/specs/core-list-graph-datatable-filtering-paging.txt b/devdocs/specs/core-list-graph-datatable-filtering-paging.txt index c3791deb..f506e60b 100644 --- a/devdocs/specs/core-list-graph-datatable-filtering-paging.txt +++ b/devdocs/specs/core-list-graph-datatable-filtering-paging.txt @@ -25,11 +25,14 @@ Filters are saved to the database: - Could be compound for joins like "table.name" (no a prepends the table name) - Special indirect values such as "[TAGS]" which means cross filter with tags - op=one of the values specified in the FilterComparisonOperator class in Biz namespace - - value= straight up direct comparison value + - value = string version of direct comparison value or could be a special token meaning more + - Never an empty string, empty string is invalid value + - All Tokens are a value surrounded by this fragment: "{[XXX]}" where XXX is the token + - if empty or null then will be a token "{[null]}" - If string then a string fragment, case is sensitive - If date then iso style date //RAVEN NOTE: it is my intention that dates come in iso8601 UTC format from the client - could be whole number or decimal number - - Could be a special "macro" filter value like "[THIS_MONTH]" (always surrounded by square brackets, no need to disambiguate with a string because only applies to non string values) + - Could be a special "macro" filter value like "{[THIS_MONTH]}" - Could be a series of id values like this "[23,45,56,123]" as in tag id's or something related to that case. Upon user selecting a filter to use the list query string has the regular paging info but also the filter id as a query parameter diff --git a/server/AyaNova/biz/DataFilterBiz.cs b/server/AyaNova/biz/DataFilterBiz.cs index 3e8f9b96..c6601fa5 100644 --- a/server/AyaNova/biz/DataFilterBiz.cs +++ b/server/AyaNova/biz/DataFilterBiz.cs @@ -292,8 +292,8 @@ namespace AyaNova.Biz if (!FilterComparisonOperator.Operators.Contains(opType)) AddError(ValidationErrorType.InvalidValue, "Filter", $"Filter array item {i}, \"op\" property value of \"{opType}\" is not a valid FilterComparisonOperator type"); } - if (filterItem["value"] == null) - AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"value\" property "); + if (filterItem["value"] == null || string.IsNullOrWhiteSpace(filterItem["value"].Value())) + AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing or is empty the required \"value\" property "); //NOTE: value of nothing, null or empty is a valid value so no checking for it here } } diff --git a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs index 5d67707a..271506b6 100644 --- a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs +++ b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs @@ -51,16 +51,7 @@ namespace AyaNova.Biz sb.Append(sColumn); sb.Append(" "); - //Added: 13-July-2006 prior fix on the 6th either broke due to other changes or - //was not enough in the first place, oddly it was working then, but this is also needed - //now to make it work: - - //Handle bools with null values - //this comes about from a user selecting blanks or nonblanks to filter a bool column - if (sValue == "" && sDataType == "System.Boolean") - { - sValue = "False"; - } + //handle null values separately if (sValue == "")