From cb54498829abea4e679f491d27cb1e4b2c692045 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 16 Mar 2020 23:07:48 +0000 Subject: [PATCH] --- server/AyaNova/PickList/PickListSqlBuilder.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/AyaNova/PickList/PickListSqlBuilder.cs b/server/AyaNova/PickList/PickListSqlBuilder.cs index b061323f..44ff897e 100644 --- a/server/AyaNova/PickList/PickListSqlBuilder.cs +++ b/server/AyaNova/PickList/PickListSqlBuilder.cs @@ -93,19 +93,18 @@ namespace AyaNova.PickList //TAGS COLUMN // if (o.ColumnDataType == UiFieldDataType.Tags) - { - //Handle tags for each part of the sql query - //idea is they display as a comma separated list, - //filter as a like comparison to each individual tag and - //order by the array which appears in testing to do it left to right as if it was a giant string - + { lSelect.Add($"(array_to_string({valueColumnName},',')"); //tags can order by without the arraytostring lOrderBy.Add(valueColumnName); //THIS is the best filter method for a like comparison to each individual tag: //(array_to_string(awidget.tags,',') like '%zo%') - if (HasAutoCompleteQuery) + //Note that a tag specific query takes precendence over this which exists + //in cases where there are tags in the template and the user has not specified a tag specific query + //so this will handle it as a like query against all tags as a composite string of text just like + //all the other templated fields + if (HasAutoCompleteQuery && !HasTagSpecificQuery) sWhere = $"(array_to_string({valueColumnName},',') like '%{autoCompleteQuery}%')"; }