This commit is contained in:
@@ -25,7 +25,7 @@ namespace AyaNova.PickList
|
||||
const int MAXIMUM_RESULT_COUNT = 100;
|
||||
|
||||
//Build the query for a picklist request
|
||||
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery, string tagSpecificQuery, bool IncludeInactive, long preId)
|
||||
internal static string Build(IAyaPickList pickList, List<string> templateColumnNames, string autoCompleteQuery, string tagSpecificQuery, bool IncludeInactive, long preId, string variant)
|
||||
{
|
||||
|
||||
//determine this in advance as it will be used in a loop later
|
||||
@@ -44,6 +44,14 @@ namespace AyaNova.PickList
|
||||
string TagSpecificWhereFragment = string.Empty;
|
||||
string PredefinedOnlyWhereFragment = string.Empty;
|
||||
|
||||
string VariantWhereFragment = string.Empty;
|
||||
bool HasVariantWhereFragment = false;
|
||||
if (!string.IsNullOrWhiteSpace(variant) && pickList is IAyaPickListVariant)
|
||||
{
|
||||
VariantWhereFragment = ((IAyaPickListVariant)pickList).GetVariantCriteria(variant);
|
||||
HasVariantWhereFragment = !string.IsNullOrWhiteSpace(VariantWhereFragment);
|
||||
}
|
||||
|
||||
//PROCESS ROW ID "VALUE" COLUMN
|
||||
//
|
||||
AyaPickListFieldDefinition rowIdColumn = pickList.ColumnDefinitions.FirstOrDefault(z => z.IsRowId == true);
|
||||
@@ -230,10 +238,15 @@ 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 || IncludeInactive == false)
|
||||
if (preId > 0 || lWhere.Count > 0 || HasTagSpecificQuery || HasVariantWhereFragment || IncludeInactive == false)
|
||||
{
|
||||
sb.Append(" where ");
|
||||
|
||||
if (HasVariantWhereFragment)
|
||||
{
|
||||
sb.Append($"({VariantWhereFragment}) and ");
|
||||
}
|
||||
|
||||
if (HasTagSpecificQuery)
|
||||
{
|
||||
sb.Append(TagSpecificWhereFragment);
|
||||
|
||||
Reference in New Issue
Block a user