This commit is contained in:
2020-03-23 22:22:34 +00:00
parent 7e361d3f41
commit cd5d06a8a6

View File

@@ -41,6 +41,7 @@ namespace AyaNova.PickList
string ActiveSelectFragment = string.Empty;
string ActiveWhereFragment = string.Empty;
string TagSpecificWhereFragment = string.Empty;
string PredefinedOnlyWhereFragment = string.Empty;
//PROCESS ROW ID "VALUE" COLUMN
//
@@ -50,6 +51,11 @@ namespace AyaNova.PickList
throw new System.ArgumentNullException($"DEV ERROR in PickListSqlBuilder.cs: picklist for {pickList.DefaultListObjectType.ToString()} has no rowId column specified in columnDefinitions list");
PlIdSelectFragment = rowIdColumn.SqlIdColumnName + " as plId";
if (preId != 0)
{
PredefinedOnlyWhereFragment = rowIdColumn.SqlIdColumnName + " = " + preId.ToString();
}
//PROCESS ACTIVE COLUMN
//
@@ -198,7 +204,7 @@ namespace AyaNova.PickList
//WHERE
//there is a condition where there is no where (inactive=true and no query of any kind)
if (lWhere.Count > 0 || HasTagSpecificQuery || IncludeInactive==false)
if (preId > 0 || lWhere.Count > 0 || HasTagSpecificQuery || IncludeInactive == false)
{
sb.Append(" where ");
@@ -214,6 +220,12 @@ namespace AyaNova.PickList
sb.Append(" and ");
}
if (preId > 0)
{
sb.Append(PredefinedOnlyWhereFragment);
sb.Append(" and ");
}
if (lWhere.Count > 0)
{
//Put all the regular query terms in parenthesis to ensure it's all treated as one criteria