This commit is contained in:
2020-12-03 18:18:58 +00:00
parent 77d114743c
commit 5da01d776a

View File

@@ -21,7 +21,7 @@ namespace AyaNova.PickList
//Maximum number of results to return at any given time
//did a little research and may adjust this but it can be fairly girthy in this day and age
//and many people might not want or need to autocomplete type if we provide enough leeway.
//for example, if you're selecting a
const int MAXIMUM_RESULT_COUNT = 100;
//Build the query for a picklist request
@@ -52,6 +52,8 @@ 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();
@@ -67,6 +69,7 @@ namespace AyaNova.PickList
AyaPickListFieldDefinition activeColumn = pickList.ColumnDefinitions.FirstOrDefault(z => z.IsActiveColumn == true);
if (activeColumn == null)
{
//no active column which is normal for some types of objects
//so make a fake one and return them all as active=true as all lists must return the same format
ActiveSelectFragment = "true as plActive";
@@ -82,9 +85,18 @@ namespace AyaNova.PickList
//this is the normal path unless there is an override
//if there is an override to see inactive too then we just don't set the filter on active
if (!IncludeInactive)
{
if (preId != 0)
{
//pre-selected need to always appear regardless of active status
ActiveWhereFragment = $"({rowIdColumn.SqlIdColumnName} = {preId}) or ({activeColumn.SqlValueColumnName} = true)";
}
else
{
ActiveWhereFragment = activeColumn.SqlValueColumnName + " = true";
}
}
}
//PROCESS TAG SPECIFIC QUERY