From 061b05035bc6c32e3673872f04c0ff1204879dc9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 13 Jan 2021 17:26:51 +0000 Subject: [PATCH] change picklist preselect from a single long to a array of long --- server/AyaNova/PickList/PickListSqlBuilder.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/PickList/PickListSqlBuilder.cs b/server/AyaNova/PickList/PickListSqlBuilder.cs index ba4e6758..6f052d7e 100644 --- a/server/AyaNova/PickList/PickListSqlBuilder.cs +++ b/server/AyaNova/PickList/PickListSqlBuilder.cs @@ -97,10 +97,11 @@ namespace AyaNova.PickList //if there is an override to see inactive too then we just don't set the filter on active if (!IncludeInactive) { - if (preId != 0) + if (preIds.Length>0) { //pre-selected need to always appear regardless of active status - ActiveWhereFragment = $"({rowIdColumn.SqlIdColumnName} = {preId}) or ({activeColumn.SqlValueColumnName} = true)"; + //ActiveWhereFragment = $"({rowIdColumn.SqlIdColumnName} = {preId}) or ({activeColumn.SqlValueColumnName} = true)"; + ActiveWhereFragment = $"({rowIdColumn.SqlIdColumnName} in ({string.Join(",", preIds)})) or ({activeColumn.SqlValueColumnName} = true)"; } else { @@ -241,7 +242,7 @@ namespace AyaNova.PickList //WHERE //there is a condition where there is no where (inactive=true and no query of any kind) - if (preId > 0 || lWhere.Count > 0 || HasTagSpecificQuery || HasVariantWhereFragment || IncludeInactive == false) + if (preIds.Length > 0 || lWhere.Count > 0 || HasTagSpecificQuery || HasVariantWhereFragment || IncludeInactive == false) { sb.Append(" where "); @@ -262,7 +263,7 @@ namespace AyaNova.PickList sb.Append(" and "); } - if (preId > 0) + if (preIds.Length > 0) { sb.Append(PredefinedOnlyWhereFragment); sb.Append(" and ");