diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 86220d9c..b6c78346 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -112,21 +112,28 @@ namespace AyaNova.DataList { DataListField AyaField = new DataListField(); - var cust = dr.GetString(qSelect.map[f.GetSqlValueColumnName()]); - if (!string.IsNullOrWhiteSpace(cust)) + //could be null + var rawValue = dr.GetValue(qSelect.map[f.GetSqlValueColumnName()]); + if (rawValue != null) { - JObject j = JObject.Parse(cust); - //convert field name to cust name then get value - var InternalCustomFieldName = FormFieldReference.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField); - //Sometimes a custom field is specified but doesn't exist in the collection so don't assume it's there - // AyaField.v = j[InternalCustomFieldName].Value(); - JToken o = j[InternalCustomFieldName]; - if (o != null) - AyaField.v = o.Value(); - else - AyaField.v = null; + string cust = rawValue.ToString(); + if (!string.IsNullOrWhiteSpace(cust)) + { + JObject j = JObject.Parse(cust); + //convert field name to cust name then get value + var InternalCustomFieldName = FormFieldReference.TranslateLTCustomFieldToInternalCustomFieldName(TemplateField); + //Sometimes a custom field is specified but doesn't exist in the collection so don't assume it's there + // AyaField.v = j[InternalCustomFieldName].Value(); + JToken o = j[InternalCustomFieldName]; + if (o != null) + AyaField.v = o.Value(); + else + AyaField.v = null; - row.Add(AyaField); + row.Add(AyaField); + }else{ + AyaField.v=null; + } } /*