This commit is contained in:
2020-02-13 23:44:39 +00:00
parent b79c98cc9d
commit 128bd786f8
2 changed files with 8 additions and 22 deletions

View File

@@ -12,24 +12,11 @@ namespace AyaNova.DataList
internal static class DataListSqlSelectBuilder
{
//Build the SELECT portion of a list query based on the template, mini or full and the object key in question
internal static string Build(List<AyaDataListFieldDefinition> objectFieldsList, JArray listViewArray)
//Build the SELECT portion of a list query based on the ListView fields
internal static string Build(List<AyaDataListFieldDefinition> objectFieldsList, List<string> listViewFieldList)
{
//convert to strings array (https://stackoverflow.com/a/33836599/8939)
// [{key:"COLUMN UNIQUE KEY ID",sort:"-" or "+",filter:{any:true/false,items:[{FILTER OBJECT SEE BELOW}]} }, {key:"second column unique key"},{...etc...}]
string[] templateFieldList;
if (mini!=null && mini==true)
{
templateFieldList = ((JArray)jtemplate["mini"]).ToObject<string[]>();
}
else
{
templateFieldList = ((JArray)jtemplate["full"]).ToObject<string[]>();
}
StringBuilder sb = new StringBuilder();
sb.Append("SELECT ");
@@ -50,7 +37,7 @@ namespace AyaNova.DataList
sb.Append(" AS df");
foreach (string ColumnName in templateFieldList)
foreach (string ColumnName in listViewFieldList)
{
AyaDataListFieldDefinition o = objectFieldsList.FirstOrDefault(x => x.FieldKey == ColumnName);
#if (DEBUG)