internal ReportColumnMapping FindColumnByUniqueName(string uniqueName) { var found = ColumnProvider.Find(DataSourceId, uniqueName); if (found != null && found.Count > 1) { throw new Exception("More than one column found matching '" + uniqueName + "'"); } return(found != null?found.SingleOrDefault() : null); }
public virtual ReportColumnMapping FindColumnByFieldName(string table, string field, FieldAggregationMethod aggregationMethod, int?statTransposeKeyValue = null, bool cacheOnly = false) { var found = ColumnProvider.Find(_constants.DataSourceId, table, field, statTransposeKeyValue, cacheOnly); if (found.Count > 1) { found = found.Where(x => x.FieldAggregationMethod == aggregationMethod).ToList(); if (found.Count > 1) { if (statTransposeKeyValue > 0) { throw new Exception(string.Format("Found more than one column for {0}.{1} (transpose key value: {2})", table, field, statTransposeKeyValue)); } throw new Exception(string.Format("Found more than one column for {0}.{1} (aggregation method : {2})", table, field, aggregationMethod)); } } return(found.SingleOrDefault()); }