This commit is contained in:
2020-03-18 00:01:03 +00:00
parent d0e3ed61e8
commit d1e7de27b2

View File

@@ -176,15 +176,20 @@ namespace AyaNova.PickList
sb.Append(ActiveSelectFragment); sb.Append(ActiveSelectFragment);
sb.Append(", "); sb.Append(", ");
//nope, this will return null if any of the values are null, very bad for this use, instead
//select name || ' ' || serial || ' ' || array_to_string(tags,',') as display from awidget //select name || ' ' || serial || ' ' || array_to_string(tags,',') as display from awidget
//this, on the other hand will work even if all of them are null
//concat_ws(' ', awidget.name, awidget.serial, auser.name)
sb.Append("concat_ws(' ', ");
foreach (string s in lSelect) foreach (string s in lSelect)
{ {
sb.Append(s); sb.Append(s);
sb.Append(" || ' ' || ");//sb 11 characters sb.Append(",");
} }
//clear trailing concat element //clear trailing comma
sb.Length -= 11;//length of last concat fragment above sb.Length -= 1;
sb.Append(" as plname"); sb.Append(") as plname");
//FROM //FROM
sb.Append(" "); sb.Append(" ");
@@ -223,13 +228,16 @@ namespace AyaNova.PickList
sb.Append(")"); sb.Append(")");
}else{ }
//we might have a trailing and to remove else
//jesus this stuff sucks, there must be a better way, it seems so fragile {
if(!IncludeInactive || HasTagSpecificQuery){ //we might have a trailing and to remove
//trailing " and " to remove //jesus this stuff sucks, there must be a better way, it seems so fragile
sb.Length-=5; if (!IncludeInactive || HasTagSpecificQuery)
} {
//trailing " and " to remove
sb.Length -= 5;
}
} }
//ORDER BY //ORDER BY