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 ");