private AnalysisProcessingYCategoryValue YCategoryForRow(ICrmDataSourceRow row) { AnalysisCategoryValue categoryValue = this.Settings.Category.CategoryValueForRow(row); if (categoryValue == null || categoryValue.Key.Length == 0) { if (this.Settings.ShowEmpty) { categoryValue = this.Settings.Category.EmptyValue(); } else { return(null); } } var ycategory = this.yCategories.ValueOrDefault(categoryValue.Key); if (ycategory == null) { ycategory = new AnalysisProcessingYCategoryValue(this, categoryValue); if (this.yCategories == null) { this.yCategories = new Dictionary <string, AnalysisProcessingYCategoryValue> { { ycategory.Key, ycategory } }; this.yCategoryArray = new List <AnalysisProcessingYCategoryValue> { ycategory }; } else { this.yCategories.SetObjectForKey(ycategory, ycategory.Key); this.yCategoryArray.Add(ycategory); } } return(ycategory); }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisProcessingQueryResultRowExecutionContext"/> class. /// </summary> /// <param name="dataSource">Data source</param> /// <param name="yCategoryValue">Y category value</param> /// <param name="xCategoryValue">X category value</param> /// <param name="processingContext">Processing context</param> public AnalysisProcessingQueryResultRowExecutionContext(ICrmDataSourceRow dataSource, AnalysisProcessingYCategoryValue yCategoryValue, AnalysisProcessingXCategoryValue xCategoryValue, AnalysisProcessing processingContext) { this.Row = dataSource; this.YCategoryValue = yCategoryValue; this.XCategoryValue = xCategoryValue; this.ProcessingContext = processingContext; }
/// <summary> /// Gets column value for analysis processing result column /// </summary> /// <param name="processingResultColumn">Processing result column</param> /// <param name="yCategory">Y category</param> /// <returns>Returns result column value</returns> public static AnalysisProcessingResultColumnValue ColumnValueForAPResultColumnYCategory(AnalysisProcessingResultColumn processingResultColumn, AnalysisProcessingYCategoryValue yCategory) { AnalysisResultColumn resultColumn = processingResultColumn.ResultColumn; if (resultColumn is AnalysisSourceFieldResultColumn) { return(new AnalysisProcessingSimpleResultColumnValue((AnalysisSourceFieldResultColumn)resultColumn, yCategory, processingResultColumn)); } if (resultColumn is AnalysisTableResultColumn) { return(new AnalysisProcessingTableResultColumnValue((AnalysisTableResultColumn)resultColumn, yCategory, processingResultColumn)); } if (resultColumn is AnalysisValueResultColumn) { return(new AnalysisProcessingValueResultColumnValue((AnalysisValueResultColumn)resultColumn, yCategory, processingResultColumn)); } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisProcessingResultColumnValue"/> class. /// </summary> /// <param name="processingResultColumn">Processing result column</param> /// <param name="yCategory">Y category</param> public AnalysisProcessingResultColumnValue(AnalysisProcessingResultColumn processingResultColumn, AnalysisProcessingYCategoryValue yCategory) { this.ProcessingResultColumn = processingResultColumn; this.YCategoryValue = yCategory; }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisProcessingValueResultColumnValue"/> class. /// </summary> /// <param name="resultColumn">Result column</param> /// <param name="yCategoryValue">Y category value</param> /// <param name="processingResultColumn">Processing result column</param> public AnalysisProcessingValueResultColumnValue(AnalysisValueResultColumn resultColumn, AnalysisProcessingYCategoryValue yCategoryValue, AnalysisProcessingResultColumn processingResultColumn) : base(processingResultColumn, yCategoryValue) { this.ResultColumn = resultColumn; this.ValueFunction = this.ResultColumn.ValueFunction; this.AggregationType = this.ResultColumn.AggregationType; if (this.ResultColumn.IsStatic) { this.valueAggregator = new AnalysisProcessingStaticValueAggregator(); } else if (this.ResultColumn.ValueOptions.IsText) { this.valueAggregator = new AnalysisProcessingStringValueAggregator(this.ResultColumn.ValueOptions); } else if (this.AggregationType != null) { this.valueAggregator = this.AggregationType.CreateValueAggregator(); } else { this.valueAggregator = new AnalysisProcessingSumValueAggregator(); } this.SignificantQueryResultTableIndices = this.ResultColumn.SignificantQueryResultTableIndices; if (this.SignificantQueryResultTableIndices.Count == 0) { this.SignificantQueryResultTableIndices = new List <object> { 0 }; } this.complete = true; }
private List <object> YCategoriesForRow(ICrmDataSourceRow row) { List <object> categoryValues = this.Settings.Category.CategoriesForRow(row); if (categoryValues.Count == 0) { if (!this.Settings.ShowEmpty) { return(null); } AnalysisCategoryValue emptyValue = this.Settings.Category.EmptyValue(); if (emptyValue != null) { categoryValues = new List <object> { emptyValue }; } } if (categoryValues.Count == 1) { var v = categoryValues[0] as AnalysisProcessingYCategoryValue; if (v.Key.Length == 0) { if (!this.Settings.ShowEmpty) { return(null); } } } List <object> apCategoryValues = new List <object>(); foreach (AnalysisCategoryValue categoryValue in categoryValues) { var ycategory = this.yCategories.ValueOrDefault(categoryValue.Key); if (ycategory == null) { ycategory = new AnalysisProcessingYCategoryValue(this, categoryValue); if (this.yCategories == null) { this.yCategories = new Dictionary <string, AnalysisProcessingYCategoryValue> { { ycategory.Key, ycategory } }; this.yCategoryArray = new List <AnalysisProcessingYCategoryValue> { ycategory }; } else { this.yCategories.SetObjectForKey(ycategory, ycategory.Key); this.yCategoryArray.Add(ycategory); } } apCategoryValues.Add(ycategory); } if (apCategoryValues.Count == 0 && this.Settings.ShowEmpty) { AnalysisCategoryValue emptyValue = this.Settings.Category.EmptyValue(); if (emptyValue != null) { return(new List <object> { emptyValue }); } } return(apCategoryValues); }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisProcessingSimpleResultColumnValue"/> class. /// </summary> /// <param name="resultColumn">Result column</param> /// <param name="yCategory">Y category</param> /// <param name="processingResultColumn">Processing result column</param> public AnalysisProcessingSimpleResultColumnValue(AnalysisSourceFieldResultColumn resultColumn, AnalysisProcessingYCategoryValue yCategory, AnalysisProcessingResultColumn processingResultColumn) : base(processingResultColumn, yCategory) { this.ResultColumn = resultColumn; this.SourceField = resultColumn.AnalysisField; this.WeightField = resultColumn.WeightField; this.CurrencyField = resultColumn.CurrencyField; this.aggregatedValue = 0; this.AggregationType = resultColumn.AggregationType; this.appliedRecordIdentifications = new Dictionary <string, object>(); this.queryTableIndex = resultColumn.AnalysisField.AnalysisTable.QueryTableIndex; this.count = 0; }
/// <summary> /// Initializes a new instance of the <see cref="AnalysisProcessingTableResultColumnValue"/> class. /// </summary> /// <param name="resultColumn">Result column</param> /// <param name="yCategory">Y category</param> /// <param name="processingResultColumn">Processing result column</param> public AnalysisProcessingTableResultColumnValue(AnalysisTableResultColumn resultColumn, AnalysisProcessingYCategoryValue yCategory, AnalysisProcessingResultColumn processingResultColumn) : base(processingResultColumn, yCategory) { this.ResultColumn = resultColumn; this.count = 0; this.queryTableIndex = this.ResultColumn.AnalysisTable.QueryTableIndex; }